[geeklog-devel] About the "internal" and Webservices APIs

Oliver Spiesshofer oliver at spiesshofer.com
Sat Aug 11 13:47:31 EDT 2007


To write the whole thing, you should store several templates in the 
database to accommodate different purposes for each content type, and 
make a template-flag in the database to store them, so you need code to 
upgrade the plugins and the stories tables. You would need a 
list-function that allows the creator of content to choose from several 
templates, so you need to rewrite the list-function of each plugin, the 
edit-code, write a small documentation etc.

Your code does something I could include in my site code, and it does 
the same as the simple textfile in which I currently store that text - 
but in a much more complicated way. But it is nothing that would ever 
see the core code of the next version.

I am discussing here if it would be good to implement a new, simple but 
convenient feature, and if that would also help with the webservices 
API. That would however, despite being easy, include more than 10 lines 
of code. I rather assume about a full day work once you include it into 
all plugins and do it with a proper interface, upgrade functions, 
testing etc. I am not discussing if its difficult, I rather discuss if 
its worth it before sitting down and doing all the work instead of doing 
a one-off hack that I would have to repeat every time a new version 
comes out.

Please do not take what I write in the wrong way - I appreciate your 
readiness to always provide sample code for your explanations - but the 
discussion i wanted to start was about extending the gl functionality, 
not asking for help on how to write a small hack.


Joe Mucchiello wrote:
> Couldn't this be easily done using the existing template code. Just 
> add something like this to SP_renderArticle():
>     if( !empty( $bodytext ))
>     {
> //...
>     }
>     if (!empty($_CONF['global_template'])) { // or however you want to 
> find the template
>        $T = new Template($_CONF['path_global_templates']);
>        $T->set_file('data',$_CONF['global_template']);
>        $T->set_var('intro_text',$intro_text);
>        $T->set_var('body_text',$body_text);
>         /// etc
>        $templated_text = $T->finish($T->parse('output','data'));
>    } else {
>        $templated_text = $introtext . $bodytext;
>   }
> Then your normal template just includes {templated_text} where you 
> want to show the templated version. Everything else is just interface.

More information about the geeklog-devel mailing list