How to change Menu separator How to change Menu separator
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

How to change Menu separator

Started by apassio, December 18, 2005, 07:16:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

apassio

Just upgraded to 1.4.2, and would like to customize again my template (waterdrop_son_test):

http://www.dophan.com/photos/

I see that the separator between the different menu items (e.g.  My gallery :: User mode :: Upload file) is "::".
I'd like to change that "::" into an image file (such as images/orange_carret.gif).

I tried to modify the theme.php file section:
  $template_sys_menu_spacer ="::";

with:
template_sys_menu_spacer = "<img src="http://www.dophan.com/photos/themes/water_drop_son_test/images/orange_carret.gif" border="0" vspace="12" hspace="12" />";

But this does not work, i get the following error message:
Parse error: parse error, unexpected T_STRING in /home/dophan2/public_html/photos/themes/water_drop_son_test/theme.php on line 102

Probably a silly question :-\, but help would be welcome.

Thanks

Nibbler

template_sys_menu_spacer = "<img src=\"http://www.dophan.com/photos/themes/water_drop_son_test/images/orange_carret.gif\" border=\"0\" vspace=\"12\" hspace=\"12\" />";

or

template_sys_menu_spacer = '<img src="http://www.dophan.com/photos/themes/water_drop_son_test/images/orange_carret.gif" border="0" vspace="12" hspace="12" />';

Watch the quotes.

apassio

Thanks for bothering.

Implemented, it works!

Regards ;D

donnoman

You need to prepend variables with "$" in PHP as well as paying attention to quoting as nibbler has posted.


$template_sys_menu_spacer = '<img src="http://www.dophan.com/photos/themes/water_drop_son_test/images/orange_carret.gif" border="0" vspace="12" hspace="12" />';


Quick PHP Lesson

$another_var='Hello World';
echo $another_var; // outputs: Hello World

$var = '$another_var';
echo $var; // outputs: $another_var

$var  = "$another_var";
echo $var; // outputs: Hello World

you're opening quotes determine whats need for your closing quotes, and once opened the context of the quotes don't change even if they are unbalanced.

$var = ' """ ';
echo $var; // outputs:  """

$var = " ''' ";
echo $var; // outputs:  '''

Newlines (character codes) are expanded like variables

$var = 'Hello World\n';
echo $var; // outputs: Hello World\n

$var = "Hello World\n";
echo $var; // outputs: Hello World  <with a newline character at the end>

If you are dealing with complex quoting I usually switch to using single quotes and appending each text subsection together as in.

$var = 'This is a "simple" program ' . $another_var . ' to test "Double Quoting" inside Strings.' . "\n";
echo $var; // outputs: This is a "simple" program Hello World to test "Double Quoting" inside Strings. <with a newline character at the end>

you can also escape double quotes in a double quoted section such as nibbler suggested, but it gets kinda ugly IMO.

$var = "This is a \"simple\" program $another_var to test \"Double Quoting\" inside Strings.\n";
echo $var; // outputs: This is a "simple" program Hello World to test "Double Quoting" inside Strings. <with a newline character at the end>

heredoc syntax does variable expansion but does not need double quotes to be escaped nor newlines to be expanded.
$var = <<<EOT
This is a "simple" program $another_var to test "Double Quoting" inside strings.

EOT;
echo $var; // outputs: This is a "simple" program Hello World to test "Double Quoting" inside Strings. <with a newline character at the end>



Array and object variable expansion can get tricky with syntax in double quoted strings and heredoc syntax, if something isn't working as expected then switch to single quotes and appending sections together with the "." char as I suggested before.