PostNuke

Flexible Content Management System

News

How I updated my themes from .64 to .70 rogue.

Contributed by on Jan 10, 2002 - 01:41 AM

The theme explanation mentions things like:


$info = genArticleInfo($row)


$results = getArticles(where, order, limit)


$links = genArticleLinks($info)


$preformat = genArticlePreformat($info, $links)




Screw that. I didn't need any of it. Try to follow these instructions, I appologize if they're kind of rambling... :) All themes are not made the same, so I can't into specifics, but if you figured out the old theme system, this is a piece of cake once you sit and work with it a bit.




First step.


BACK UP YOUR THEME! Once you update your functions they will not completely work until you finish updating each variable.




Next


Look through your theme. Anywhere you have a variable - such as $informant, $title, or $comments, more than likly you will replace it with either a call to $info[informant], $preformat[title], or $links[comment].




Now, a brief explanation of the differences between them:


Items in $info contain JUST test. No formating.


ex: $info[topicimage] is just "announcements.gif" (no quotes)


Items in $links contain just the URL. Again, no formating.


Items in $preformat are formatted and already contain links and everything. Very handy.


$preformat[title] already figured out story id, and title name and formats it so that it's already clickable




Here we go...


Look at function themearticle()


Remove everything in the parenthesis of themearticle() and replace it with "$links, $info, $preformat." It should now look like: function themearticle($links, $info, $preformat)




Ok, your theme will be completely broken for now. I hope you saved. I made one change at a time and checked the results. Things should start appearing one by one.




Replace each variable ($cid, $hometext, $notes, informant) with the corresponding variable below. Note: if you use any of the $info or $links variables you will probably have to use them along with HTML to get links or formatting.




for instance: modules.php?op=modload&name=News&file=article&sid=$sid&mode=&order=0 will become modules.php?op=modload&name=News&file=article&sid=$info[sid]&mode=&order=0 or use $preformat[title]




If you have lengthy sections of code for formatting your article body, changes are you can just use $preformat[fulltext]




Be creative. Once you do a few, you'll be amazed at how easy it actually is.




Admin Check


Instead of using if ($admin) for your [Edit] [Delete] lines, use the following bit of code:




if (authorised(0, $storyComponent, '::', ACCESS_ADMIN)) {


echo " [ "._EDIT." | "._DELETE." ]n";


}




Note: I added spaces in the < a href> and statements






List of variables from themes.postnuke.com:




$info variables are NOT formatted. They're just raw information from the database.


$info[bodytext] - the main text of the story


$info[briefdatetime] - short version of the date and time the story was published


$info[briefdate] - short version of the date the story was published


$info[catandtitle] - the category and title of the story, in the format 'Category: Title' if the story is in a particular category


$info[cid] - the ID of the category the story is in


$info[catid] - the ID of the category the story is in (deprecated)


$info[cattitle] - the name of the category the story is in


$info[comments] - the number of comments the story has


$info[fulltext] - home text, then body text, then notes


$info[hometext] - the header text of the story


$info[informant] - the person who submitted the story


$info[longdatetime] - long version of the date and time the story was published


$info[longdate] - long version of the date the story was published


$info[maintext] - home text, then body text


$info[notes] - any editorial notes on the story


$info[sid] - the story ID


$info[tid] - the topic ID


$info[topic] - the topic ID (deprecated)


$info[topicd] - the topic ID (deprecated)


$info[title] - the story title


$info[topicname] - the name of the topic


$info[topicimage] - pathname to the topic image


$info[topictext] - description of the topic


$info[unixtime] - the Unix timestamp of the story


$info[version] - the version of the array. This can be used to see if sepcific variabels exist in the array or not.


$info[withcomm] - if the story allows comments to be posted with it






$links variables are just that. Just the URL. They are not formated.


$links[category] - list of items in the same category as the story


$links[comment] - comments on the story


$links[fullarticle] - the story itself


$links[print] - print the story


$links[send] - send the story to a friend


$links[version] - the version of the array. This can be used to see if sepcific variabels exist in the array or not.






$preformat variables are basically plug and play (uhg! Sorry!) They're already formatted and ready to be clicked. All AutoLinks have been inserted and everything. You're probably use these the most.


$preformat[bodytext] - main body of text, including autolinks if any


$preformat[bytesmore] - 'bytes more' link (for back-compatibility)


$preformat[category] - list of items in the same category as the story


$preformat[cattitle] - the title of the story, preceded by it's category (if any)


$preformat[comment] - info on current number of comments


$preformat[fulltext] - home text, then body text, then notes


$preformat[hometext] - initial text, including autolinks if any


$preformat[maintext] - home text, then body text


$preformat[more] - single generic status link (for back-compatibility)


$preformat[notes] - any editorial notes on the story


$preformat[print] - print the story


$preformat[readmore] - 'read more' link


$preformat[send] - send the story to a friend


$preformat[title] - the title of the story


$preformat[version] - the version of the array. This can be used to see if specific variabels exist in the array or not.




The new theming system is VERY powerful, and once you realise the theory behind it, you see it's pretty easy.




I hope this helps someone.
2731