Siteseed.de

Utility Link | Utility Link | Utility Link

Documentation

siteseed logo

$php$ Macro

The $php$ macro allows to execute PHP code in layouts. A set of PHP macro functions allows to access data of all other conventional macros quite easily.

Use this macro to allow execution of PHP code within your layouts:


$php$
<?php
    echo "Hello Siteseed";
?>
$phpend$


Note: Try $endphp$ if $phpend$ does not work for you. In the future both variants will be supported!


Macro Scope


...or how to access Siteseed variables:


All macro functions including $php$ are executed within the scope of an internal Siteseed function. So in order to access global variables, e.g. interface variables, one needs to declare them global:


$php$
<?php
    global $id;
    global $headline;

    echo "ID: $id";
    echo "<br>";
    echo "Headline: $headline";

?>
$phpend$


PHP Macro Functions


There are PHP counterparts of all conventional macro functions. These PHP macro functions are only allowed to be used within layouts. They must not be used in Interfaces!  The following PHP macro functions are currently available: checkfield(), checksubject(), field(), printfield(), macro(), and printmacro().


Here is a short documentation about how to use them:


checkfield


bool checkfield(int $intFieldnumber)


Note: This function does only allow to check one field at a time.
Otherwise it works like $checkfield$


Examples:


if(checkfield(1)==true)
{
    echo "field #1 contains stuff"
}


checksubject


bool checksubject(int $intSubjectNumber)


Note: This function does only allow to check one subject at a time.
Otherwise it works like $checksubject$


Examples:


if(checksubject(1)==true)
{
    echo "subject #1"
}


field


string field(int $intFieldNumber)


Note: Returns the content of the field defined by $intFieldNumber.


Examples:


if(field(1)=="triggervalue")
{
    echo "special layout goes here";
}
if(field(2)!="")
{
    echo field(2);
}
if(checkfield(3)==true)
{
    echo field(3);
}


printfield


void printfield(int $intFieldNumber)


Note: Prints the content of the field defined by $intFieldNumber


Examples:


if(field(2)!="")
{
    printfield(2);
}
if(checkfield(3)==true)
{
    printfield(3);
}


macro


string macro(string $strMacroName)


Note: Returns the value of a conventional macro defined by $strMacroName


Examples:


echo macro(0);
echo macro(1);
echo macro('$0$');
echo macro('$1$');
echo macro('author');


if(macro('author')=="admin")
{
    your stuff;
}


printmacro


void printmacro(string $strMacroName)


Note: Prints the value of a conventional macro defined by $strMacroName


Examples:


printmacro(0);
printmacro(1);
printmacro('$0$');
printmacro('$1$');
printmacro('author');


 

Printer friendly version

-

Static Section Pages The Static Section Page (Static Section) feature allows mapping of html pages to sections. These html pages may be placed/stored in any directory within the site root of your siteseed installation. The only exception are siteseed system directories (e.g. bo).


$ifcontent$ Macro The new $ifcontent$ macro allows to create dynamic layouts depending on content of article fields.


FCK Editor FCK Editor (http://www.fredck.com/FCKeditor/) is now available as Siteseed Module and can be used to replace the current visual editor. It's an external module, because it's licenced under the GNU Lesser General Public Licence (LGPL).


$php$ Macro The $php$ macro allows to execute PHP code in layouts. A set of PHP macro functions allows to access data of all other conventional macros quite easily.


Component Types The current siteseed release offers features not yet covered by the official documentation. One of these features are component types. They e.g. extend comon editor fields by predefined default content and a lot of other things.


Sitelib Documentation Sitelib is a library that encapsulates code that is often used in siteseed interfaces. This includes mainly database queries in order to achieve a higher level of abstraction and to be more independent of possible database changes in the future. This article explains all library functions and provides examples for their proper usage.


About Us | Site Map | Privacy Policy | Contact Us | © 2004 Siteseed.de
Siteseed is a trademark of Mr.Net - Serviços Informáticos, Lda