Posted on: 06/13/06 05:42am
By: LWC
What's so special about files like (featured)storytext.thtml and footer.thtml that stops me from directly using PHP in them (like I can in, say, header.php)?
If I try, it's just as if I tried to use PHP code in a regular HTML page.
Yes, of course I can do it via system/lib-story.php, lib-common.thtml, etc. but those files are customized anyway so it's annoying to customize in 2 different places each time instead of one.
Why PHP only in some templates?
Posted on: 06/27/06 07:34pm
By: LWC
I also noticed I can't use PHP towards the end of header.thtml but only towards the end! What's going on?
Why PHP only in some templates?
Posted on: 06/27/06 07:44pm
By: Anonymous (blah)
The header.thtml is the only file that you should be able to use php in. The reason for this is they are template files, if it were all php it would cause a ton of overhead and using templates would be meaningless in the first place.
No idea why you can't use php at the end of your header.thtml file other then to suspect you have a typo in your code.
Why PHP only in some templates?
Posted on: 06/28/06 05:01am
By: LWC
Look, the word php and the code are just shown as HTML. It only happens if the code is around the comment "START OF CONTENT AREA".
And I still like to know how come it just (generally) works in header.thtml. What's so special about it?
Why PHP only in some templates?
Posted on: 06/28/06 07:04am
By: ajohnson
The reason you are having trouble can be due to two things. One, you are putting the added markup in the wrong place, or two, you are writing invalid markup. There is nothing special about any .thtml file. They are just segments of a web page to be assembled by GL.
Why PHP only in some templates?
Posted on: 06/28/06 08:33am
By: LWC
Look, if you don't know the answer don't reply, but stop blaming me for not knowing PHP.
It's real simple. PHP works in most of header.thtml, just not if I use it towards the end of the file. In the other templates I've mentioned it doesn't work anywhere.
Why PHP only in some templates?
Posted on: 06/28/06 10:52am
By: ajohnson
You misunderstand. You need to write valid HTML for a site to render properly. The .thtml pages are segments of a whole page. Just putting a code snippet somewhere , anywhere does not work. You need to place things in such a way that when the pages are joined, the markup is not broken. Yopu are somehow breaking the page. I also know how to write valid html and I make mistakes too. We all do.
Why PHP only in some templates?
Posted on: 06/28/06 03:02pm
By: LWC
Listen, any php code works in header.thtml...unless it's towards the end of the file.
Why PHP only in some templates?
Posted on: 06/28/06 03:08pm
By: Dirk
[QUOTE BY= LWC] And I still like to know how come it just (generally) works in header.thtml. What's so special about it?[/QUOTE]
Because it's run through eval() and because it's
documented[*1] that it only works in header.thtml.
bye, Dirk
Why PHP only in some templates?
Posted on: 06/28/06 06:10pm
By: ajohnson
Meh. My bad. I thought LWC was talking about {varname} in the markup. Learn something new every day.
Why PHP only in some templates?
Posted on: 06/28/06 06:10pm
By: LWC
Well, at least now I know it's documented. What do the other templates use if not eval()? And how come it doesn't work towards the end of header.thtml? Can you at least tell me the percise point when it stops working?
Thanks!
Why PHP only in some templates?
Posted on: 06/28/06 10:00pm
By: Anonymous (blah)
[QUOTE BY= LWC] Look, if you don't know the answer don't reply, but stop blaming me for not knowing PHP.[/QUOTE]
Sorry for trying to help it wont happen again.
Why PHP only in some templates?
Posted on: 06/28/06 10:15pm
By: Anonymous (blah)
btw this bit of code works
everywhere in my header.thtml file, including within the comment you seem to be having issues with.
<?php
echo 'blah';
?>
I was never trying to suggest you don't know how to code php just that perhaps you had a typo somewhere or something. Not trying to help here but are you sure you incased you code in
<?php and ?>
tags?
Why PHP only in some templates?
Posted on: 06/29/06 05:42am
By: LWC
Look, any code I write works...unless I put it around said comment. If it's in the beginning of the file, it works. If it's in the middle of the file, it works. If it's in the end of the file, it doesn't work.