coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: apassio on December 18, 2005, 07:16:15 PM

Title: How to change Menu separator
Post by: apassio on December 18, 2005, 07:16:15 PM
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
Title: Re: How to change Menu separator
Post by: Nibbler on December 18, 2005, 07:18:10 PM
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.
Title: Re: How to change Menu separator
Post by: apassio on December 18, 2005, 07:41:56 PM
Thanks for bothering.

Implemented, it works!

Regards ;D
Title: Re: How to change Menu separator
Post by: donnoman on December 18, 2005, 08:11:51 PM
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.