Fork me on GitHub

Theme Guide: Tips for easier theme writing and starter theme  Bottom

Go to page 1 - 2 - 3 - 4 - 5 - 6 - 7 [+1]:

  • Hi everybody! The following is a few thoughts on creating new themes in Postnuke, somewhat aimed at newbies but also for theme creators who have followed the not-so-great coding examples of the themes included with Postnuke installations (though the themes themselves are great!).

    At the end of the first section of this post is an “updated” version of the Extralite theme which you are welcome to cut and paste for use as your own “starter theme” (more on that below).

    Part I - Writing theme.php the “right” way:
    In short, when writing themes, HTML should be written as HTML and PHP should be written as PHP. One of the great strengths of PHP is that it allows the coder to break out of PHP and code HTML on a dime with no performance setback by simply specifying closing and opening PHP tags where you want to start PHP code again. In fact, it is faster for your server to process a PHP/HTML mix this way.

    Instead of coding HTML where it should be, most theme creators resort to using ‘echo’ statements to tell PHP to output everything in quotes, and worse yet, include the output in double-quotes, necessitating “escaped” double quotes for any quotes used in the HTML code.

    This is not necessary and is in fact, a sloppy way to define a theme whose output is *mostly* HTML. If you look at the modified Extralite theme example at the bottom of this post, you will not see one ‘echo’ statement in the code. Whenever I need to start coding HTML for the theme, I simply pop-out of PHP with a closing ‘?>’ tag; when I need to insert some PHP code (even if it’s in the middle of an HTML block), I go back to PHP with an opening ‘’ in the theme without the prior declaration. I don’t have a list of vars you can fetch with this function, but as far as other theme vars, see http://www.mentalbloc.net

    Some Final Creative Tips:
    1. You are by no means limited to having the traditional left-block, center-block, right-block layout in your themes. Put the left/right blocks both on the left, or change the code for the right blocks to surround them with tags and make them appear in a horizontal row (remember to start and end the right block “table” in the conditional “show right blocks” PHP in the footer HTML). Just put the ‘’ code where you want the block set to appear. Now that you can edit your themes in your WYSIWYG editor, your creativity can flourish!

    2. You can have your right and/or center blocks appear on every page by simply removing the ‘if ($GLOBALS['index'] == 1)’ conditional statement from around the appropriate block statement in the header/footer.

    3. Link Colors: If you want to be able to have different link colors in the different block positions but those darned hard-coded ‘class=”PN-normal”’ tags are messing up your layout, don’t fret – style sheets have the answer. The solution lies in the “specificity” of the style sheet element. In other words, more specific declarations will override other declaration in your style sheet… Here what you do:

    In your theme, assign a class to the HTML element that contains the output you want to make different from the default… (For example add ‘class=” PN-content-leftblock” to the tag where you left-block content would appear). Then in the style sheet, make some specific declarations as to what you want the content to look like in this block by stating the “overriding” class first, a space, them the class you want to override. Add as many as you like separating by commas. For example, I wanted the contents of my left blocks to appear in white for a reverse-type effect with a yellow mouseover for links:

    Code

    TD.pn-content-leftblock, TD.pn-content-leftblock .pn-normal, TD.pn-content-leftblock A.pn-normal:link, TD.pn-content-leftblock A.pn-normal:visited, TD.pn-content-leftblock A:link, TD.pn-content-leftblock A:visited {
    color: #FFFFFF;
    font: 11px "Trebuchet MS", Trebuchet, Tahoma, Verdana, Helvetica, Arial;
    }

    TD.pn-content-leftblock A.pn-normal:hover, TD.pn-content-leftblock A:hover {
    color: #FFFF33;
    font: 11px "Trebuchet MS", Trebuchet, Tahoma, Verdana, Helvetica, Arial;
    }


    Well that’s it! I welcome any input on the post above and encourage you to post links to resources (either from this forum or outside) to helpful information on creating themes. As promised, here’s the modified ExtraLite theme for use as a starter theme…

    CODE FOR MODIFIED EXTRALITE STARTER THEME:

    Code

    <?php
    // File: $Id: theme.php,v 1.7 2003/07/15 23:37:59 markwest Exp $ $Name:  $
    // ----------------------------------------------------------------------
    // POST-NUKE Content Management System
    // Copyright (C) 2001 by the PostNuke Development Team.
    // http://www.postnuke.com/
    // ----------------------------------------------------------------------
    // Based on:
    // PHP-NUKE Web Portal System - http://phpnuke.org/
    // Thatware - http://thatware.org/
    // ----------------------------------------------------------------------
    // LICENSE

    // This program is free software; you can redistribute it and/or
    // modify it under the terms of the GNU General Public License (GPL)
    // as published by the Free Software Foundation; either version 2
    // of the License, or (at your option) any later version.

    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.

    // To read the license please visit http://www.gnu.org/copyleft/gpl.html
    // ----------------------------------------------------------------------
    // Original Author of file:  Francisco Burzi
    // Purpose of file: Display a low bandwidth theme.
    // ----------------------------------------------------------------------
    $bgcolor1 = '#ffffff'; // Table cell color
    $bgcolor2 = '#cccccc'; // Module table border color & light "bar" color font some modules (Comments, FAQ, etc...)
    $bgcolor3 = '#ffffff'; // Unknown
    $bgcolor4 = '#eeeeee'; // Unknown
    $bgcolor5 = '#000000'; // Block table border color
    $textcolor1 = '#ffffff'; // Light color reverse type used by some modules
    $textcolor2 = '#000000'; // Dark color reverse type used by some modules
    $postnuke_theme = true;

    // Begin HTML for module table cell
    function OpenTable()
    {
    ?>
        <table width="100%" cellspacing="0" cellpadding="8" bgcolor="<?= $GLOBALS[bgcolor1] ?>" >
            <tr><td>

    <?     
    }

    // End HTML for module table cell
    function CloseTable()
    {
    ?>
        </td></tr>
            </table>
           
    <?     
    }


    // Begin HTML for module table cell
    function OpenTable2()
    {
    ?>
        <table cellspacing="0" cellpadding="8" bgcolor="<?= $GLOBALS[bgcolor1] ?>"  align="center">
            <tr><td>
       
    <?
    }

    // End HTML for module table cell
    function CloseTable2()
    {
    ?>
        </td></tr>
            </table>
           
    <?     
    }

    // HTML for page header (less <HEAD> content)
    function themeheader()
    {
        $sitename = pnConfigGetVar('sitename');
        $slogan = pnConfigGetVar('slogan');    
    ?>
       <style>
             TABLE.thinborder {border-top: solid 1px <?= $GLOBALS[bgcolor5] ?>; border-right: solid 1px <?= $GLOBALS[bgcolor5] ?>;}
             TD.thinborder {border-left: solid 1px <?= $GLOBALS[bgcolor5] ?>; border-bottom: solid 1px <?= $GLOBALS[bgcolor5] ?>;}
         </style>
       </head>
         
         <!-- Layout Start -->
         
       <body>
         
    <?     
        if(pnModAvailable('Banners'))
        {
            pnBannerDisplay();
        }
    ?>     
       
            <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
            <tr><td bgcolor="<?= $GLOBALS[bgcolor1] ?>">
            <table border="0" cellspacing="0" cellpadding="3" width="100%" bgcolor="<?= $GLOBALS[bgcolor1] ?>">
            <tr><td><a href="index.php"><img src="<?= WHERE_IS_PERSO ?>images/logo.gif" alt="<?= _WELCOMETO ?> <?= $sitename ?> :: <?= $slogan ?>" border="0"></a></td>
            <td align="right">
            <form action="modules.php" method="post">
            <input type="hidden" name="name" value="Search">
            <input type="hidden" name="file" value="index">
            <input type="hidden" name="op" value="modload">
            <input type="hidden" name="action" value="search">
            <input type="hidden" name="overview" value="1">
            <input type="hidden" name="active_stories" value="1">
            <input type="hidden" name="bool" value="AND">
            <input type="hidden" name="stories_cat" value="">
            <input type="hidden" name="stories_topics" value="">
            <div align="right"><font class="pn-normal"><?= _SEARCH ?>
            <input class="pn-text" NAME="q" TYPE="text" VALUE="">
            <b><?= date('l, F jS, Y') ?></b></font></div></form>
            </td></tr>
            </table>
            </td></tr>
            <tr>
            <td valign="top" width="100%" bgcolor="<?= $GLOBALS[bgcolor1] ?>">
            <table border="0" cellspacing="0" cellpadding="2" width="100%">
         <tr><td valign="top" width="150" bgcolor="<?= $GLOBALS[bgcolor1] ?>">
         <? blocks('left'); ?>
        <img src="images/global/pix.gif" border="0" width="100%" height="1" alt="">
              </td>
              <td>  </td>
              <td valign="top">
    <?                 
        if ($GLOBALS['index'] == 1) {
            blocks('centre');
        }
    }

    // HTML for page footer
    function themefooter()
    {
        if ($GLOBALS['index'] == 1) {
    ?>
           </td>
                  <td>  </td>
                  <td valign="top" width="150" bgcolor="<?= $GLOBALS[bgcolor1] ?>">
           
    <?  blocks('right');           
        }
    ?>       
        </td></tr></table>
              </td></tr></table>
              <center>
        <? footmsg(); ?>
        </center>
           
            <!-- Layout end -->
           
    <?     
    }

    // HTML for article teaser block
    function themeindex ($_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $info, $links, $preformat)
    {
    ?>
       <table cellpadding="3" cellspacing="0" width="100%" class="thinborder">
               <tr>
                 <td bgcolor="<?= $GLOBALS[bgcolor1] ?>" class="thinborder"><b> <?= $preformat[catandtitle] ?></b>
                   <font class="pn-normal">
                   <?= _POSTEDBY ?> : <?= $info[informant] ?> <?= _ON ?> <?= $info[longdatetime] ?>
               
                <a href="<?= $links[searchtopic] ?>"> <?= $info[topicname] ?> </a> </font></td>
            </tr>
            <tr>
              <td bgcolor="<?= $GLOBALS[bgcolor1] ?>" class="thinborder"><font class="pn-normal">
                <?= $info[hometext] ?>
               
               
                <?= $preformat[notes] ?>
               
               
                </font></td>
            </tr>
            <tr>
              <td bgcolor="<?= $GLOBALS[bgcolor1] ?>" align="right" class="thinborder"><font class="pn-sub">
                <?= $preformat[more] ?>
                </font></td>
            </tr>
          </table>


    <?
    }

    // HTML for full article page
    function themearticle ($_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $info, $links, $preformat)
    {
    ?>
        <table cellpadding="3" cellspacing="0" width="100%" class="thinborder"><tr><td bgcolor="<?= $GLOBALS[bgcolor1] ?>" class="thinborder">
        <font class="pn-title"><?= $preformat[catandtitle] ?></font><font class="pn-normal"><font class="pn-sub"><?= _POSTEDBY ?>: <?= $info[informant] ?> <?= _ON ?> <?= $info[briefdatetime] ?></font></font>

        <?
            if (pnSecAuthAction(0, 'Stories::Story', $info[aid].':'.$info[cattitle].':'.$info[sid], ACCESS_EDIT)) {
            ?>
               <font class="pn-normal"> [ <a href="admin.php?module=NS-AddStory&op=EditStory&sid=<?= $info['sid'] ?>"><?= _EDIT ?></a> ]
        <?
                if (pnSecAuthAction(0, 'Stories::Story', $info[aid].':'.$info[cattitle].':'.$info[sid], ACCESS_DELETE)) {
        ?>
                     [ <a href="admin.php?module=NS-AddStory&op=RemoveStory&sid=<?= $info['sid'] ?>"><?= _DELETE ?></a> ]</font>
            <?             
            }
        }
        ?>
           
              <font class="pn-normal">
              <a href="<?= $links[searchtopic] ?>"><?= $info[topicname] ?></a>
              </font>
        </td></tr><tr><td bgcolor="<?= $GLOBALS[bgcolor1] ?>" class="thinborder"><font class="pn-normal">
        <?= $preformat[fulltext] ?>
        </font></td></tr></table>
    <?     
    }


    // HTML for left, right and center blocks
    function themesidebox($block) {

         if (empty($block['position'])) {
          $block['position'] = 'a';
       }

         // Left Block HTML
         if($block['position'] == 'l') {

    ?>
       <table width="100%" cellspacing="0" cellpadding="3" >
         <tr>
           <td bgcolor="<?= $GLOBALS[bgcolor1] ?>" class="pn-title">
             <?= $block[title] ?>
           </td>
         </tr>
         <tr>
           <td bgcolor="<?= $GLOBALS[bgcolor1] ?>" class="pn-normal">
             <?= $block[content] ?>
           </td>
         </tr>
       </table>
       
    <?


        }

        // Right Block HTML
        if($block['position'] == 'r') {  
    ?>
       <table width="100%" cellspacing="0" cellpadding="3" >
         <tr>
           <td bgcolor="<?= $GLOBALS[bgcolor1] ?>" class="pn-title">
             <?= $block[title] ?>
           </td>
         </tr>
         <tr>
           <td bgcolor="<?= $GLOBALS[bgcolor1] ?>" class="pn-normal">
             <?= $block[content] ?>
           </td>
         </tr>
       </table>
       
    <?

        }
       
      // Center Block HTML
        if($block['position'] == 'c') {
    ?>
       <div class="pn-normal"><?= $block[content] ?></div>
    <?
        }

    }

    ?>


    __________________________________

    Theme Guide: Tips for easier theme writing and starter theme
    Part II - Personalizing the user experience...

    I'm back with more theming tidbits for ya!

    Do you really want to personalize your themes and articles on your website?

    Then pnUserGetVar is your buddy! With this easy-to-use pnAPI function you can echo detailed information for either the current user or for the poster of a news item.

    For example, instead of saying "Posted by username" in your article blocks, you could personalize it a bit by saying "Posted by Boo Radley from Buffalo, NY" and even include their avatar or links to their ICQ, AIM, etc... in the post much like this message board!

    Here's how ya do it...
    (Note: all examples assume you are writing your HTML as HTML in your theme [not echoing it] and that you have short tags enabled in your PHP.ini)

    To echo a user variable *for the current, logged-in user*, for this example we'll echo their "real name" in the theme, use:

    Code

    <?= pnUserGetVar('pn_name') ?>

    The < ? tags, as you should know, break out of the HTML and the equal sign is shorthand for echo. The function, "pnUserGetVar" is called with the field name of the variable you want to get in single quotes.

    Check out the "nuke_users" table in your database for a list of the field names (unless someone wants to post a list here). In a nutshell, though you can echo *any* variable about the user contained in this table.

    Personalizing Article Posts:
    You can also echo extra user information of the author of a news posting on your website to personalize in a bit. Under the themeindex and themearticle sections of your theme.php the author of a given article is sent to the theme as $info['aid'].

    Using the extra operator of the pnUserGetVar function, you can echo user information of the person who authored the post. For example (we'll echo the author's real name this time):

    Code

    <?= pnUserGetVar('pn_name', $info['aid']) ?>

    In this case, we're sending along the author id as well as the user variable we want to get. You could include the poster's instant messaging info, their avatar, location, and more! The possiblities are numerous!

    Use your logic...
    Instead of blindly echoing user info to your theme, there are cases where you may want to apply some logic... Just assign the pnUserGetVar to a variable and code away! For example (in one of the article blocks):

    Code

    $location = pnUserGetVar('pn_user_from', $info['aid']);
    if ($location = '') {
        $location = 'Nowheresville';
    }

    Then you can echo the modified location in your theme...

    Dynamic Data
    You can also echo any dynamic data you have added to the user profile. Just substitute the name of the user variable from the nuke_users table for the name you gave the dynamic variable (generally, '_SOMETHING'). For example:

    Code

    <?= pnUserGetVar('_EXTRAVAR') ?>

    With the power of dynamic variables, you could for example, prompt the user to enter their zip code and display a custom weather report for their area somewhere in the theme.

    Note: For some reason, using the "dynamic" values of the core user info does not work (the values found in the nuke_user_property table). So, use the field names of nuke_users for these values...

    _____________________________________

    Theme Guide: Tips for easier theme writing and starter theme
    Part III - Stupid Theme Tricks...

    Note: The Proposal for alternate block styles below (using classic theming) was added to a special "tweaked" starter theme, along with other frequently requested features. See these posts for "VersaTheme" starter theme and more "Stupid Theme Tricks":
    many F.A.Tweaks
    ">"VersaTheme" Starter…w/many F.A.Tweaks
    HOW TO: Alternating … newz block trick

    Alternate block styles:
    One easy idea I had for different block style options....
    (I haven't fleshed it or written the code yet - and yeah, I know about AutoTheme)

    When the site admin creates a new block (left/right or center) they could specify one of many different left, right or center types by including some info before (or after) the block name, using some type of text delimeter...

    For Example:
    User creates a new block (doesn't matter what kind) and instead of naming it: "New Block", they enter "type1|New Block"

    Then in the theme, under the "themesidebox" function, the script could do a simple split function (using the pipe "|" delimeter, in this case) on the $block[title] variable. If it sees that an option was appended to the front of the block, a switch/case could be used to then draw different HTML for the block depending the type specified. If no type is specified or no valid one, the theme just draws the default left, right or center block...

    To clarify: The blocks would still be tied to the left, right or center zones and would be ordered as normal, but the extra code would allow different HTML for the left, right and center blocks...

    Whadaya think? The code would be easy, with no appreciable processing overhead and allows for easy extra flexibility. If anyone has interest, I could probably whip it up real quick, or post your code here...

    More Stupid Theme Tricks:
    many F.A.Tweaks">"VersaTheme" Starter…e w/many F.A.Tweaks
    HOW TO: Group Topic …wspaper or magazine
    HOW TO: Alternating …e news block tricks
    Theme Add-in: Indivi…ain Pages & Modules
    HOW TO: Links to Rel…s for Article Pages

    __________________________________

    Theme Guide: Tips for easier theme writing and starter theme
    Part IV - List of Variables Passed to Theme Stories
    Below is a list of the values of the three arrays, $info, $preformat & $links which are passed to the themeindex (story summary) and themearticle (full story) functions of your theme.php. Some of them contain the same information, but are output in different ways.

    The $info array is just raw output and gives you the best flexibility for customizing your theme. You can combine them with HTML output to get any custom output you desire. The values follow:

    $info['aid'] : Author ID - useful for fetching detailed info about the author that they may have entered in the user profile (described in Section II above)
    $info['bodytext'] : The main bodytext of the story,
    $info['catthemeoverride'] : Name of Theme for Override (set for category)
    $info['cid'] : Category ID
    $info['cattitle'] : Category title
    $info['comments'] : No. of story comments
    $info['counter'] : No. of story reads
    $info['hometext'] : Index page text (lead text)
    $info['informant'] : Username of author
    $info['notes'] : Notes
    $info['sid'] : Story ID
    $info['themeoverride'] : Name of Theme for Override (set for story)
    $info['tid'] : Topic ID
    $info['time'] : Time posted
    $info['title'] : Story title
    $info['topicname'] : Topic name
    $info['topicimage'] : Topic image name, minus all pathnames, good for use with theme based topic images
    $info['topictext'] : Topic description text (handy for the topic image ALT="" tag)
    $info['tcounter'] : No. of stories in topic
    $info['unixtime'] : Time/Date posted in UNIXTIME format
    $info['withcomm'] : unknown
    $info['topicid'] : Topic ID
    $info['catid'] : Category ID
    $info['version'] : unknown
    $info['longdatetime'] : Time/Date long format
    $info['briefdatetime'] : Time/Date brief format
    $info['longdate'] : Date long format
    $info['briefdate'] : Date brief format
    $info['catandtitle'] : Category and title
    $info['maintext'] : Extended text
    $info['fulltext'] : Complete text


    The $preformat array, has some of the story information with HTML included to automatically create links, images with links, etc... They make getting a layout up and running quicker but offer less flexibility. The values are below:

    $preformat['bodytext'] : Extended text, same as $info[bodytext].
    $preformat['bytesmore'] : Displays the number of bytes more in the format "n bytes more" ( n=number of bytes ).
    $preformat['category'] : Displays the category name as a link, if no category is selected for the story, the link is still generated but no category text is displayed, thereby making the link invisible.
    $preformat['comment'] : Displays the number of comments in the format "n Comments" or "Comments?" if no comments already exist, with an attached link, to the comments page.
    $preformat['hometext'] : Opening text of the article, same as $info[hometext].
    $preformat['notes'] : Notes of the article, same as $info[notes].
    $preformat['searchtopic'] : Displays the Topic icon with alt text preset to the topic name, and an attached link to the topic search...
    $preformat['print'] : Displays the print friendly page icon with alt text "print friendly page" or language equivalent, with attached link to the printer friendly view.
    $preformat['readmore'] : Displays "Read more..." with the attached link to the full article / comments page.
    $preformat['send'] : Displays the send to a friend icon with alt text "send to a friend" or language equivalent, with attached link to the send to a friend page.
    $preformat['title'] : Displays the story Title with the postnuke standard CSS class "PN-title" applied, with the attached link to the full article / comments page.
    $preformat['version'] : unknown
    $preformat['more'] : Displays the complete standard read more line, in the format "Read more... (b bytes more) n Comments" followed by the send and print icons. All associated links are included. (b = number of bytes more | n = number of comments)
    $preformat['catandtitle'] : Displays the Category name (unless articles is the current category) and the story title in the format "Category:Story Title" (nb. The story title only has the class PN-title applied) associated links are attached.
    $preformat['maintext'] : Display the complete story text.
    $preformat['fulltext'] : Display the complete story text.


    The $links array contains *just the links* (URLs/URIs) used in a story. To effectively use them, they must be included in an anchor tag (generally in the HREF attribute) in your theme. The values are as follows:

    $links['category'] : Links to the current story category list
    $links['comment'] : Links to the comments page for the story
    $links['fullarticle'] : Links to The full article text
    $links['searchtopic'] : Links to Search the current topic
    $links['print'] : Links to Print friendly view
    $links['send'] : Links to Send article to a friend
    $links['version'] : unknown



    edited by: nate_02631, Apr 08, 2007 - 10:20 AM

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Very nice work. Thanks for the contribution! Just to make it even easier, I have converted all of the included PostNuke themes (except ExtraLite) into AutoTheme themes.

    All HTML, so just open in an editor and tweak to your liking. All colors, templates, block display and module configuartions can be done in the admin of AT-Lite or AutoTheme 1.7.

    -Shawn

    P.S. There are some php.ini seetings that are needed for syntax to work.

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • Good point on the php.ini, AbraCadaver. While pretty much most recent PHP installs are set up with "short tags" enabled, in case you have trouble using '
  • For quite a few people, that php.ini thing won't help, that's only effective if you've got access to it or your shared server is running PHP as a CGI.

    --
    Home Page | Find on Facebook | Follow on Twitter
  • Well, at any rate, mhalbrook, *most* PHP configs are installed with short tags enabled so it's kind of moot. At any rate they can sub
  • nate,

    For the .7x style of theming then this is a logical approach to take. But AutoTheme and xanthia, the .8 theme engine (soon to be available for .726 - I promise i'm working on it non stop at the moment ;)), take a different approach.

    This approach is the template and template engine apporach. HTML files are created with placeholder tags that are then processed by 'the engine'. The end result is actually what you've outlined in your original post; that of HTML with injected PHP.

    This approach then hides PHP totally from the theme designer actually allowing this person to be a designer and not a designer/coder.

    @shawn - can AutoTheme not be updated to use
  • Sounds good, Mark

    Yeah it sure seems logical - so why don't more theme designer's do it that way, eh? wink

    I'm not sure how I feel about AutoTheme - I didn't see any provisions made for caching so it seems like it has to parse out the theme and include *several* files(!) every time it's called! Whew! That's a lot of parsing and disk-seeking for a high-volume site (I only glanced at AT though, so I'm not positive on the caching comment)....

    I'm surprised you guys didn't integrate something like Smarty or something... It's ready-made and powerful... Will you guys be going to something like Xaraya (is that a bad word here?) where you basically have control of not only the theme but the block-level content as well (though Xaraya theming seems hard!)

    In the interim (while we are still in the nuke .7 series) I will post another theming tidbit below - hope someone gets some use from it!

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • I'm not sure about caching in AutoTheme so i'll leave that to Shawn to answer.

    Where I refer to Xanthia I should properly refer to XTE (Xanthia template engine) as this consists of two modules one of which, rather confusingly, is named Xanthia. It wasn't intended to be this way but the oriignal pnRender (which wasn't a module and would have been bundled with xanthia) didn't pan out the way we'd hoped (maxdev and envolution wiill hit this if they use the components properly) so a new pnRender was built from scratch.

    As it happens XTE uses Smarty. The two modules are Xanthia for theme components; Block templates, theme header, footer etc. and pnRender for module output (this requires modules coded to use templated output). Despite pnRender not being released the first module has already been announced on mods.postnuke.com. The pnCommerice team are porting pnCommerce to use pnRender and I have three or four modules on the go that will be fully templated (i've picked up a few old, abandoned modules to demo the concepts).

    The problem with caching in a dynamic enviroment like PN is permissions and how you determine if the cache is valid. The caching is not quite there yet for the Xanthia but for pnRender caching is implemented and documented using the example module.

    The logic of the tempating is similiar to that of xaraya (which is not a bad word from my perspective). but hopefully easier to get to grips with. Given the use of Smarty we have the benefit of a well established project for the basis of our templating. This inherently helps the maturity of our solution both in terms of code and documentation. There is already a fair bit of Smarty documentation around.

    pnRender is already is testing (with the pnCommerce team) and I hope to have a Xanthia build for our pnCorps team by the end of this weekend subject to me being able to spend the time i've got allocated to it at the moment.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Hi Mark,

    Quote

    @shawn - can AutoTheme not be updated to use
  • Hi there,

    Thanks for you post nate, really informative, but soon it will only be a history lesson. My advice to you is to start using AutoTheme, it is the only option at the moment, but it will get you prepared for the template system of Xanthia, or whatever.

    I have been making themes for a long time now and I used to use the original system, then Xanthia (the old module) and then AutoTheme - AutoTheme is by far the best on offer at the moment.

    Don't waste your time with the original theme system, get AutoTheme and start having some fun :) Have a look at some of my themes for tips at www.iwebdesign.co.nz

    Kindest regards
    Lobos

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • Shawn,

    Thanks for clarifying those points. I too was going on nate's original post so apologies for any incorrect assumptions I made.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Lobos

    Thanks for you post nate, really informative, but soon it will only be a history lesson. My advice to you is to start using AutoTheme, it is the only option at the moment


    Hi - define "soon"... Not criticizing development times, but PN has been at .7x for about a couple years now and we're only up to .726. Unless I hear differently from one of the core developers, I don't expect a .8 with it's radical template changes for at least another year...

    As far AutoTheme being "the only option", at least where ATL is concerned I think it is a waste of overhead using it for themes when most I see seem to use the "left-center-right" block formula. I think many folks were turned off on themes because the core ones use the "HTML as PHP" methodology which users thought had to be emulated...

    When PN .8+ *does* come out, I would prefer to learn it's theming system rather that relying on a third-party commercial module.

    And if the .8 theming is a robust and user-friendly one, which should be a goal of any good CMS, I'd say Autothemers will be the one's who are "history" :)

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • The .8 timescales are still fairly open (baecause there's still a lot to be done in the porting of modules to pnRender) but Xanthia will be released for .726 (soon - real soon). I'm spending (almost) every waking minute tidying this for release.

    Once this available then the end user will have two choices of theming system, AutoTheme and xanthia along with legacy themes. In addition developers will be able template module output using pnRender. This is in final testing with the pnCommerce team who have been extremely helpful in testing the code.

    I'm currently porting all of the standard themes to Xanthia themes. Currently we have

    http://pn726.markwest.me.uk/index.php?theme=nucleus (my main site theme as a xanthia theme)
    http://pn726.markwest.me.uk/index.php?theme=SeaBreeze
    http://pn726.markwest.me.uk/index.php?theme=pnDefault.

    Each theme is taking a couple of hours to port with the time taken reducing with each one I do.

    I've not done much with new zones to show off the layout capabilities but the concept is very similar to AutoTheme. A tag representing the block zone is placed at the correct point in the master template. Xanthia defines block zones in the admin panel rather than the config file.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Oh boy, I can't wait for Xanthia! :D

    Mark, I tried visiting the CVS via dev.postnuke.com but all the top links on the site were busted. Is there any preliminary documentation for the Xanthia engine? I've looked all around to no avail... I am already familiar with Smarty but am interested in seeing some of the Nuke-specific template coding....

    As for the validity of the post that started this topic, I'd say it will remain quite relevant for quite some time since Mark says PN .8+ will continue to support the "legacy themes". And for many people, the legacy way of theming will serve them well with minimal fuss... (especially if they follow my tips above! wink )

    As for me, I am anxious to learn more about the Xanthia engine...

    P.S. What do y'all think of my second "theming tidbits" post (about 6 "up" from this one) re: accessing the user vars for articles, etc... I hadn't seen it exploited really so I hope someone finds it and get some use from it.... (anyone writing theme docs is welcome to include it!)

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...

Go to page 1 - 2 - 3 - 4 - 5 - 6 - 7 [+1]:

This list is based on users active over the last 60 minutes.