News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

non-random quote mod

Started by TMF, July 02, 2005, 03:48:23 AM

Previous topic - Next topic

TMF

I know there is a quote puller mod already, but what I am looking for is something different, yet naming it quote mod was as closest as I could think of to what I am looking for.

I have written this myself for some other software despite being no programmer, but SMF is more complex, so hoping someone could help me.

FUNCTIONALITY: For every topic, this mod will display a certain text in the appropriate place depending on the placement in the template. There will be 10 different texts (I used just ten text files on the server, but whatever it will be is fine). The mode will find the topic number, and display the appropriate text out of the ten. Ie. if the topic number ends with 1, text no. 1 will be displayed, for topic ending 2, it will be text no. 2, and so on. That's the core of the idea, not to do it the random way, but the static way - so that the next time you look on that topic, there will be still same text displayed.

In the other software, I wrote a few lines script that was added to the main dir and it just found out the topic number and returned the appropriate text back. One varaible string was put to the template, and that was it. Would appreciate if someone could help me with that one on SMF. Maybe SMF works a different way and such a simplistic solution wouldn't be possible?

Yonkey

Instead of text files, you could do this using a database table.  The table would contain two columns: ID (number from 0 to 9) and quote (text quotation).

Then, the only code you need to add to the template is a database query:

SELECT quote from <table> where ID = RIGHT(<currently viewing ID_TOPIC>, 1)


I'm just not sure what SMF variable the <currently viewing ID_TOPIC> is stored in.

TMF

Thanks a lot! I will try to find out and implement it the way you suggested. Seems doable even for someone like me :).

Advertisement: