PDA

View Full Version : Load content from file


kingMOB
08-09-2008, 08:35 PM
Hi,

I'm trying to create a simple command line to load the content of a txt file into a template.

The idea is host a lot of txt files in the server that are named as the id of each forum (255.txt, 235.txt...) and when a user, for example, enters http://forum.forum.com/forumdisplay.php?f=221 this command will insert the content of the 221.txt file somewhere in the template.

Any ideas? =)

Thanks.

Marco van Herwaarden
08-10-2008, 12:20 PM
<a href="http://www.vbulletin.com/docs/html/main/templates_externalfiles" target="_blank">Including External Files</a>

kingMOB
08-11-2008, 11:11 PM
Thank you Marco, I tried this simple plugin, hooked it to "global_start", execution order 5:

$incluirads = implode('', file('images/{$foruminfo[forumid]}.txt'));

In the hope that when activated the plugin could get the $foruminfo[forumid] number from the forum from which it was been loaded and complete the command line like:

$incluirads = implode('', file('images/{221.txt'));

And, load the 221.txt file for that forum. But, I just could make it works without the $foruminfo[forumid] variable, which is essential to me.

Is there a way to put the $foruminfo[forumid] variable in the plugin, so it load the correct txt file for each forum?

Thanks

Marco van Herwaarden
08-12-2008, 06:57 AM
I don't think global_start is the correct hook location to use. It is executed on each page, even if no forum info available.