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

More documentation

Quote Reply
More documentation
Ok, I know there hasnt been a complete stabe release yet, so I dont knowif there will be any more documentation just yet. The thing I am having troubleto get the hang of is;

1) What is the difference with globals.php and globals.txt (both are presentin the default_php templates folder)

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

Thanks for any help anyone can give.I've tried to work out as much as I can by myself and lookig at the othertemplates, but I just wanted to check on the exact formats and stuffWink


Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

AndyNewby: Jan 2, 2002, 12:25 PM
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
Quote Reply
Re: [brewt] More documentation In reply to
Thanks for that Adrian. Unfortunatly the reason I manually editing theglobals file was because of a problem I am having (seehttp://www.gossamer-threads.com/...orum_view_collapsed;).As for the tags, wow, didnt realise it was that easy Tongue I'm learning PHP atthe moment (btw, when you use = in the if statement, i think it should have beenan == Wink).

Thanks for the help, hopefully I can work it out from here!

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!