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
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
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;
}
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>
<?
}
}
?>
// 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';
}
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...
