Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 03:41:44 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
149621 Posts in 21098 Topics by 7537 Members
Latest Member: lotte2
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Highlight Code & Syntax while modify 'Code' sections  (Read 420 times)
sharmpro

Offline Offline

Posts: 64



WWW
« on: July 25, 2008, 11:34:35 PM »

Hi,

using a lot of code programming I found really useful to implement the code/syntax highlignt feature already implemented in Template Edit.

....
....
....
....

NEW LINES IN RED

File: WB_PATH/modules/code/modify.php

// Get page content
$query = "SELECT content FROM ".TABLE_PREFIX."mod_code WHERE section_id = '$section_id'";
$get_content = $database->query($query);
$content = $get_content->fetchRow();
$content = (htmlspecialchars($content['content']));


/* Codepress ****************************************************************************/
// make sure that codepress stuff is only used if the framework is available
$CODEPRESS_CLASS = '';
$CODEPRESS_JS = '';
if(file_exists(WB_PATH .'/include/codepress/codepress.js')) {
    $CODEPRESS_JS = 'onclick="javascript: data_codepress_'.$section_id.'.value = my_codepress_'.$section_id.'.getCode();"';
    $CODEPRESS_CLASS = 'class="codepress php" ';
}
/* Codepress ****************************************************************************/


// Insert vars
$template->set_var(array(
                                'PAGE_ID' => $page_id,
                                'SECTION_ID' => $section_id,
                                'WB_URL' => WB_URL,
                                'CONTENT' => $content,
/* Codepress ****************************************************************************/
                                'CODEPRESS_CLASS' => $CODEPRESS_CLASS,
                                'CODEPRESS_JS' => $CODEPRESS_JS,
/* Codepress ****************************************************************************/

                                'TEXT_SAVE' => $TEXT['SAVE'],
....
....
....
....


NEW LINES IN YELLOW


File: WB_PATH/modules/code/modify.html

<textarea name="content" id ="my_codepress_{SECTION_ID}" {CODEPRESS_CLASS} style="WIDTH: 100%; HEIGHT: 380px">{CONTENT}</textarea>

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
    <td align="left">
        <input type="submit" value="{TEXT_SAVE}" {CODEPRESS_JS} style="width: 100px; margin-top: 5px;" />

....
....
....


Stefano
Logged

Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!