MortysTW
07-03-2005, 05:03 AM
This is how to make a 2nd Latest Topics Module for CMPS v2.x. I personally needed a module that showed the Latest Jokes by their creation date only. Also the way my module templates are, I can't use the MODULE SHELL template for modules on my right or left column. Below I show the basic instructions for the typical module creation for a 2nd Latest Topics Module. But for those of you in my situation, I also explain how I went about getting the additional template files to work without the Module Shell template.
There might be a better way, but this is how I went about doing it.
1. Go to the modules directory on your server and make a copy of your latesttopics.php module file and then rename it to whatever you want. For me, I made it to latestjokes.php.
2. If you want this new module to list the threads by THREAD CREATION DATE like I needed to do, open your new file from Step 1. If you want it to work like it does by default, move onto Step 3. Do a search for ORDER BY lastpost DESC and change the word lastpost to thread.dateline so that it reads ORDER BY thread.dateline DESC
3. Upload the file you created in Step 1 to your modules directory on your webserver with the other modules. (ie.ForumRoot/modules)
4. On your webpage, go to the AdminCP. Now go to vBa CMPS>Edit Modules and then click on Latest Forum Topics. Top of page at MODULE TOOLS under the SELECT AN ACTION, on the drop down choose COPY and then hit the GO button. Page will reload. Its a copy of the Latest Forum Topics and it won't truely exist until you make some edits and hit the SAVE button. Change the MODULE TITLE to whatever you want. For me it was Latest Jokes. And do all the other edits you normally do with the modules such as what column it appears in, which forums to display and so on. When done hit the SAVE button.
5. If you use the Module Shell template for all your modules irregardless of what column they go in, your done! That's it. Wasn't that easy? CMPS v2.0 makes it simple. If you are in my situation where you can't use the Module Shell template for your left or right columns, but only your center columns, continue on to Step 6. To understand why I can't use the Module Shell, feel free to look at my site and you'll notice how I use curved boxes that die into the sides of the pages. Its an adult humor site so you've been warned. No porn on the front page, just maybe some objectionable text depending on what others have titled their threads. http://www.MortysTwistedWorld.com
6. Can't use the Module Shell template for your right or left columns? For those that are used to just pasting their unique right and left template code into templates for modules to make them look right, you'll notice that with the Latest Topics module or whatever you titled yours will be individual repeated blocks. If you chose to display 10 Latest Topics, it will actually appear that you have 10 modules that are only displaying 1 topic. Its the way the latesttopics.php page works and repeats itself and calls for templates.
7. In your website's AdminCP, click on STYLES & TEMPLATES>STYLE MANAGER and then on the drop down, select ADD NEW TEMPLATE. For my side modules, I have a table that sorta wraps around the module content and the content is just displayed in a cell. So I have to create a TOP template and a BOTTOM template to avoid that repeating module "look" that happens by default. Create a title for this new template, I'll use my title, latesttopicbits_jokes_top. Then put all your content in the Template box and hit SAVE. Then repeat this step to add a new template, in which I created latesttopicbits_jokes_bottom. Again hit SAVE when done.
7. Open your new file you created in Step 1. You need your TOP and your BOTTOM template to wrap all the content created by this module.
Do a search for (should be about line 11):
if ($mod_options['portal_threads_maxthreads'])
{
Below ADD (edit to be the same as the template you created first in Step 7):
{
eval('$home["$mods[modid]"][\'content\'] .= "' . fetch_template('latesttopicbits_jokes_top') . '";');
}
Do a search for (should be about line 120):
$DB_site->free_result($threads);
unset($thread, $foruminfo);
}
Above ADD (edit to be the same as the template you created second in Step 7):
{
eval('$home["$mods[modid]"][\'content\'] .= "' . fetch_template('latesttopicbits_jokes_bottom') . '";');
}
Save and upload back to your server.
8. Now go try out your new module. Should be working just fine! :D
Additional Note: Since my Latest Jokes only lists the thread titles, I had to create a copy of the adv_portal_latesttopicbits and I named it latesttopicbits_jokes and deleted a bunch of the stuff to clean up the template so it only displays the thread title. If you find you need to do the same thing, open back up your file you created in Step 1 and about line 103 you should see:
eval('$home["$mods[modid]"][\'content\'] .= "' . fetch_template('adv_portal_latesttopicbits') . '";');
Just edit that template name to whatever your template was.
I hope this helps a few people out. Sorry if I typed too much. I've never posted a hack or whatever you want to call this thing. This is my first time. Mind you I'm not very good at php or any type of coding. :rolleyes:
Enjoy! :)
There might be a better way, but this is how I went about doing it.
1. Go to the modules directory on your server and make a copy of your latesttopics.php module file and then rename it to whatever you want. For me, I made it to latestjokes.php.
2. If you want this new module to list the threads by THREAD CREATION DATE like I needed to do, open your new file from Step 1. If you want it to work like it does by default, move onto Step 3. Do a search for ORDER BY lastpost DESC and change the word lastpost to thread.dateline so that it reads ORDER BY thread.dateline DESC
3. Upload the file you created in Step 1 to your modules directory on your webserver with the other modules. (ie.ForumRoot/modules)
4. On your webpage, go to the AdminCP. Now go to vBa CMPS>Edit Modules and then click on Latest Forum Topics. Top of page at MODULE TOOLS under the SELECT AN ACTION, on the drop down choose COPY and then hit the GO button. Page will reload. Its a copy of the Latest Forum Topics and it won't truely exist until you make some edits and hit the SAVE button. Change the MODULE TITLE to whatever you want. For me it was Latest Jokes. And do all the other edits you normally do with the modules such as what column it appears in, which forums to display and so on. When done hit the SAVE button.
5. If you use the Module Shell template for all your modules irregardless of what column they go in, your done! That's it. Wasn't that easy? CMPS v2.0 makes it simple. If you are in my situation where you can't use the Module Shell template for your left or right columns, but only your center columns, continue on to Step 6. To understand why I can't use the Module Shell, feel free to look at my site and you'll notice how I use curved boxes that die into the sides of the pages. Its an adult humor site so you've been warned. No porn on the front page, just maybe some objectionable text depending on what others have titled their threads. http://www.MortysTwistedWorld.com
6. Can't use the Module Shell template for your right or left columns? For those that are used to just pasting their unique right and left template code into templates for modules to make them look right, you'll notice that with the Latest Topics module or whatever you titled yours will be individual repeated blocks. If you chose to display 10 Latest Topics, it will actually appear that you have 10 modules that are only displaying 1 topic. Its the way the latesttopics.php page works and repeats itself and calls for templates.
7. In your website's AdminCP, click on STYLES & TEMPLATES>STYLE MANAGER and then on the drop down, select ADD NEW TEMPLATE. For my side modules, I have a table that sorta wraps around the module content and the content is just displayed in a cell. So I have to create a TOP template and a BOTTOM template to avoid that repeating module "look" that happens by default. Create a title for this new template, I'll use my title, latesttopicbits_jokes_top. Then put all your content in the Template box and hit SAVE. Then repeat this step to add a new template, in which I created latesttopicbits_jokes_bottom. Again hit SAVE when done.
7. Open your new file you created in Step 1. You need your TOP and your BOTTOM template to wrap all the content created by this module.
Do a search for (should be about line 11):
if ($mod_options['portal_threads_maxthreads'])
{
Below ADD (edit to be the same as the template you created first in Step 7):
{
eval('$home["$mods[modid]"][\'content\'] .= "' . fetch_template('latesttopicbits_jokes_top') . '";');
}
Do a search for (should be about line 120):
$DB_site->free_result($threads);
unset($thread, $foruminfo);
}
Above ADD (edit to be the same as the template you created second in Step 7):
{
eval('$home["$mods[modid]"][\'content\'] .= "' . fetch_template('latesttopicbits_jokes_bottom') . '";');
}
Save and upload back to your server.
8. Now go try out your new module. Should be working just fine! :D
Additional Note: Since my Latest Jokes only lists the thread titles, I had to create a copy of the adv_portal_latesttopicbits and I named it latesttopicbits_jokes and deleted a bunch of the stuff to clean up the template so it only displays the thread title. If you find you need to do the same thing, open back up your file you created in Step 1 and about line 103 you should see:
eval('$home["$mods[modid]"][\'content\'] .= "' . fetch_template('adv_portal_latesttopicbits') . '";');
Just edit that template name to whatever your template was.
I hope this helps a few people out. Sorry if I typed too much. I've never posted a hack or whatever you want to call this thing. This is my first time. Mind you I'm not very good at php or any type of coding. :rolleyes:
Enjoy! :)