Forums / Cotonti / Extensions / Support / [Help] Craigslist

I need some pointers on how to create some parts of a craigslist plugin.

ven7ura
#1 2010-10-13 13:24
Hello all!

I want to create a craigslist type plugin, but I have some stuff that I would like some help with. Here are some of the issues that I think will stop me from finishing this work:

    1. How can I include the plugin with search. Any pointers on where to look would be great.
    2. I would like to have different TPLs on the plugin, I have yet to see a example on any of the plugin code that are here on Cotonti. I looked at the shopsystem plugin and it has an $output variable with the html (for example when you want to add an item), but I would like to have different TPLs so that editing in the future is more flexible.

These are only some of the issues that come to my mind. If I have more I will post them up :)

I plan on releasing it here once its finished.

Thanks in advance!
GHengeveld
#2 2010-10-13 16:47
I'm not sure about the search thing, I haven't been involved with that yet.
As for the plugin templates, you should have a look at this article.
ven7ura
#3 2010-10-14 01:02
Thank you Koradhil!

I remember reading that article a long time ago, but since I never wanted to have different tpls I guess I didn't care.

I have to:
$tpl1 = new XTemplate(sed_skinfile('pluginname', true));
Make some TAGS
$tpl1->parse('MAIN');
$tpl1->out('MAIN');

$tpl2 = new XTemplate(sed_skinfile('pluginname.second', true));
Make some TAGS
$tpl2->parse('SECOND');
$tpl2->out('SECOND');

and so on

This all goes in plugin.php, right? (just making sure :) )
GHengeveld
#4 2010-10-14 01:27
Depends on what you're trying to achieve. Usually you would use only one instance of XTemplate per plugin file. So if your plugin exists of multiple parts/pages, each with its own template file, its best to put each part in a separate file and include the file in your pluginname.php. Here's an example:



The courses.php file only contains a switch() statement which decides what file to include from the 'inc' folder. The files in 'inc' contain code similar to what you posted above.

There's no use in looking to download this plugin, it's something I built for a client, so it's private.
ven7ura
#5 2010-10-14 03:21
Yup I understand now! thanks a bunch!