Gossamer Forum
Home : Products : Gossamer Links : PHP Front End :

Re: [AndyNewby] More documentation

Quote Reply
Re: [AndyNewby] More documentation In reply to
In Reply To:
1) What is the difference with globals.php and globals.txt (both are presentin the default_php templates folder)
globals.txt was probably created when you went into the admin and looked at the globals for the default_php template set. Locally we've changed it so we don't use globals.php but globals.txt (so you can edit globals in the admin again).

The difference between the php globals.txt and the perl one is that you'll want to use PHP code instead of Perl. You'll notice in globals.txt (globals.php in your copy), date and time have been replaced with PHP code equivalents. Another difference is that in the template, to call those 'subs', you call them by <?print $date()?> instead of <%date%>.

See README.php for more differences between the PHP and Perl front ends.

In Reply To:
2) What is the equivilant for <%if%>'s etc? Is it <?if $thing?><?endif?> ??? I'ma bit confused with the new tag system. I've justabout got the hang of the basic tag stuff (like <?print $name?>), butthe ifs, ifnots etc are past me at the moment Tongue
The PHP templates are essentially just PHP files. They can contain any PHP code you wish to put in it. For help with PHP syntax, see http://www.php.net/manual. Don't be fooled by the .html extensions Smile, they are parsed by the PHP parser. The equivalent for <%if%> is <?if (statement) {?>stuff to print out<?} elseif (statement) {?>else print this stuff<?}?>.
This of course can be done differently. The <? ?>'s are for going into and out of PHP, and HTML mode for PHP's parser (see the PHP manual for more info), so technically you could do this:
Code:
<?if ($foo = "bar") {
print "output goes here";
more PHP code here
} elseif ($foo = "baz") {
print "more output goes here";
} else {
print "even more output goes here";
}?>
I don't think it's as neat though with all those print statements.
Basically, anything you can do in PHP, you can put into the templates. Hope this helps.


Adrian
Subject Author Views Date
Thread More documentation Andy 4509 Jan 2, 2002, 11:52 AM
Thread Re: [AndyNewby] More documentation
brewt 4352 Jan 2, 2002, 12:57 PM
Post Re: [brewt] More documentation
Andy 4332 Jan 3, 2002, 2:12 AM