Catads with new features
  • 2006/12/17 12:59

  • tempo

  • Just popping in

  • Posts: 96

  • Since: 2003/11/12

Hallo my friends,
i'm using Catads v1.4 on my site ( http://www.24net.gr ).

The module is great and without bugs.

but i want something about this module.
I have in use the block "Recent ads". with this block a user can see the most recent ads. My question is: is there any way to create a block with the most recent ads for a specific category? For example i want a block (like recent ads) where a user can see the 10 last ads from a category "Cars".

i think that this is easy but unfortunately i don't know anything about php & mySQL.

of course may be usefull a block with the recent 5 ads with photo?

what do you think? any suggestion or a solution?


Re: Catads with new features
  • 2006/12/17 13:24

  • chippyash

  • Friend of XOOPS

  • Posts: 501

  • Since: 2004/1/29

This is a quick hack:

at about line 49 of catads/blocks/catads_new.php, add lines

$cat= 1 // or whatever the category id of your cars category is
$criteria->add(new Criteria('cat_id', $cat, '='));

Save the file and display your block. It will show only items in the category you have selected.

For a fuller answer, you need to do a lot more I'm afraid, but basically clone the catads_new.php file, add a new option selector in b_catads_edit function, add the ability to pick this up in the b_catads_show function, add the new block details in xoops_version.php and clone the template file for the block in teh templates/blcok directory and add teh new template details in xoops_version.php. You will also need to add new language constants in teh relevent language files in the language directory. Once you've done all that, go to systems admin and update the module for the new feature to take effect.

Its a good way to start learning a bit of PHP and XOOPS programming. The catads module is quite straightforwardly (for XOOPS that is!) written so is actually IMHO, not a bad place to start learning XOOPS mod dev.

Re: Catads with new features
  • 2006/12/17 13:43

  • tempo

  • Just popping in

  • Posts: 96

  • Since: 2003/11/12

thanks for the answer.

i think there is a lot of work and that this is not easy cause i don't know anything about php & mySQL.

Do you have an easier solution?
Can i create a new "Block" as admin with PHP script?

Re: Catads with new features
  • 2006/12/17 14:38

  • Quest

  • Friend of XOOPS

  • Posts: 1034

  • Since: 2005/11/19

I think there may be an easier way to do this...

Do a search here for adding/cloning a new block for a module. There is a way to add/clone a block by adding it to the modules xoops_version.php. It may even be in the FAQs. I will try to provide you a link to the info but am running out of available time for this morning. Or maybe someone else can direct to the exact post(s).

Basically you could clone the Recent Ads block and giving it its own Name. Then modify the template file to call the recent ads for a specific category. As far as I know you could do this for as many as you like and not have to do so much hacking of other files. The defines should already be in the modules core it would just be a matter of calling it in the cloned block.

EDITED: Found it in the FAQs.
How To Clone a Block



Who's Online

61 user(s) are online (39 user(s) are browsing Support Forums)

Members: 0

Guests: 61



Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits