Injader
Forum > Help Forum > Understanding the syntax

< How to upload...? : Plugins >

ginkgo100
Permalink

Created: June 07, 2009 23:30

Understanding the syntax

I'm afraid I've hit a point with the theme code where the PHP tutorials and the Injader Help Wiki can't help me. 

First, where are functions defined?  I seem to remember they're all in a file somewhere, but I can't find the file nor directions to it in the Help Wiki.

Second, please explain the following from index.php:

1   if ($CMS->TH->GetContentCount() > 0) {
2     $strContentWrapperStart = <<<ContentWrapperStart
3 ContentWrapperStart;
4    print($strContentWrapperStart);

I understand that line 1 causes the subsequent code to be executed only if there is at least one article in the area.  In line 2, I know this is defining a variable, but what is <<<ContentWrapperStart ? I can't find anything about <<< (and it's hard to search; Google doesn't exactly recognize it as a keyword, and I don't know what to call it).  And in line 3, why is there just a label with a semicolon?  Is this a function?  Is it calling something from the database?

I'm not planning to modify this code, but understanding what the syntax is supposed to be (and whether I have inadvertently messed it up) will help me with troubleshooting my (frequent) PHP errors.

Tags: None.

Ben's avatar

Ben
Permalink


1

Created: June 07, 2009 23:49

The theme functions (called via CMS->TH) are all defined in sys/includes/html/Theme.php.

The < < < denotes heredoc syntax, an explanation of which can be found here:

Heredoc syntax

That should answer most of your questions in that area.

In this case, the start of the content wrapper is actually empty, but you could enter some HTML between lines 2 and 3 if you wanted to print something before your content items are printed, if content items exist.

Does that help? :)

(sorry, had to edit this comment as the three arrows stripped out most of the text)
ginkgo100's avatar

ginkgo100
Permalink


2

Created: June 08, 2009 16:04

Thanks, I'll look that up. Also, is there a free PHP editor you recommend? I read that these are available to help you find missing braces, semicolons, etc.
Ben's avatar

Ben
Permalink


3

Created: June 08, 2009 16:57

Try Notepad++ - it's good for other languages too, not just PHP :)

You do not have access to post comments in this area.