View Full Version : How do I put the tag cloud on a custom page?
cbiweb
02-19-2011, 05:43 PM
I've created a vBulletin powered page for the purpose of building a totally customized homepage for a client. He would like the tag cloud to be on that page. I've tried copying all the code from another page that shows the tag cloud, even tried copying an entire template onto the custom page, and got everything but the tag cloud itself. I also tried doing the registering variables thing but I don't totally understand that either, so it's most likely I've got that wrong too. Can anyone help me out on this? Thanks in advance.
Lynne
02-19-2011, 07:17 PM
I just took the code from my product - Tag Cloud on Forumdisplay (https://vborg.vbsupport.ru/showthread.php?t=229475) and added it into the page. You have stuff in the products that adds to the $phrasegroup and $globaltemplates. Then add all the code from the forumdisplay_start plugin except get rid of the whole condition around it. Then, make sure to set $foruminfo[forumid] to 0 because or else you will get an error and then get rid of anything that has to do with the $forumid - in the query and when setting the tagtest_urls (two places). Then, in your php page, make sure to register $cloud_html for your template ($templater->register('cloud_html', $cloud_html); ) and enter the variable into the template ({vb:raw cloud_html}). That should work.
cbiweb
02-19-2011, 11:53 PM
Thanks, Lynne. And sorry if I seem a bit stunned, but...
I just took the code from my product - Tag Cloud on Forumdisplay (https://vborg.vbsupport.ru/showthread.php?t=229475)...
Your product has 6 or 7 files of code. Which code did you take? All of it from all the files? Or are you talking about the optional snippets of code shown in your product thread that you linked to?
...and added it into the page.
The HTML page? PHP page?
You have stuff in the products that adds to the $phrasegroup and $globaltemplates.
It's good to have stuff. Now what to do with it? ;) :)
Then add all the code from the forumdisplay_start plugin...
Add it into what? Where?
Lynne
02-20-2011, 03:03 AM
I just went through each plugin and grabbed what was needed and put it into the custom page. For instance...
hook location - parse_templates
- This plugin adds the css to the page. Instead, I went to the taglist.css template and just copy/pasted the css into my template in the <head> area with the required <style> tags around it.
hook location - cache_templates
- This plugin caches the templates, so I just added the template names to the $globaltemplates array in the custom page.
hook location - forumdisplay_start
- This plugin has all the needed code. I grabbed it all, removed the condition around it, and removed anything having to do with $forumid in there (three places, as I said) and added at the top the thing about forumid equaling 0.
hook location - init startup
- This plugin adds the phrasegroup, so I added it to the $phrasegroup array.
hook location - tags_list_query_limit
- This hook location is done. I did nothing with the content in this plugin.
So, I basically just went through every plugin and put the contents into the proper place in the custom page.
cbiweb
02-21-2011, 10:14 PM
Thanks again, Lynne. I understand now. It may be a couple days before I get to do it, but I'll post back if I have any problems.
cbiweb
03-01-2011, 01:43 AM
Thanks to your help I was able to get the cloud on the custom page; however, clicking a tag takes me to a 404 page. :confused: Feel free to PM or email me if you'd rather take it off thread.
Lynne
03-01-2011, 01:48 AM
Have you looked at the URL and can you see what is wrong with it? Can you post a link to the page?
cbiweb
03-01-2011, 01:56 AM
Actually, right after posting I did some digging and fixed it in the tag_cloud_link template where the URL is relative (and rightly so). I made it absolute. Not the most elegant fix, but one that will get it done.
The cloud is disabled on the new page for now, until I can style a container for it tomorrow.
Lynne
03-01-2011, 04:25 PM
Glad you got it figured out. :)
cbiweb
03-04-2011, 06:41 PM
ugh... I'm just not getting this. The cloud is there, but two elements of it I don't want: the collapse button and the heading "Tag Cloud". I know it's all put together from various templates, and I've tried using the relevant snippets and pasting them into my custom template, but it's not working. Very frustrating. Here's the page (http://www.productforum.info/) with the cloud, and you can see the result. View in Chrome to see the missing image icon, since it doesn't show up in Firefox. My time is so limited for troubleshooting, it's taking me days to get this done. :(:(:(
Lynne
03-04-2011, 10:12 PM
You don't want it collapsible and you don't want the title, Tag Cloud, to show? So, you only want the tags themselves? If so, then remove this from the template:
<div class="collapse">
<a class="collapse" id="collapse_forum_tags" href="{vb:raw relpath}#top"><img src="{vb:stylevar imgdir_button}/collapse{vb:raw vbcollapse.collapseimg_info_options}_40b.png" alt="" /></a>
<h4 class="forumoptiontitle blockhead"><span class="optiontitle">{vb:rawphrase tag_cloud}</span></h4>
</div>
cbiweb
03-07-2011, 01:21 PM
That would remove it from everywhere, including the forums. I just want it removed from the new custom page. I'll explain a little more what's happening...
In the template for the custom page, the cloud is powered by this:
{vb:raw cloud_html}That pulls in the cloud, which apparently uses multiple templates and code from the forum templates & files, which includes the collapse button and title. When I tried grabbing what I believe is the relevant code I actually want from these other sources, and paste them directly into my custom template, the cloud doesn't work at all. The code you posted above is one of the snippets I pasted into the custom template, but no go.
There must be a much easier way to figure this out, but vB4's new way of handling things has stymied me. I feel like a n00b all over again, LOL.
Lynne
03-07-2011, 05:27 PM
Then put a condition around that code that removes it for your custom page. Did you define THIS_SCRIPT on your page? If so:
<vb:if condition="THIS_SCRIPT != 'your_page'">
<div class="collapse">
<a class="collapse" id="collapse_forum_tags" href="{vb:raw relpath}#top"><img src="{vb:stylevar imgdir_button}/collapse{vb:raw vbcollapse.collapseimg_info_options}_40b.png" alt="" /></a>
<h4 class="forumoptiontitle blockhead"><span class="optiontitle">{vb:rawphrase tag_cloud}</span></h4>
</div>
</vb:if>
Or create a custom template to use instead of that one and reference it in your code.
cbiweb
03-08-2011, 12:35 PM
Okay, that does the trick. Not sure why that didn't come to me in a dream or something. But maybe that's it - I need more sleep! lol
Uhm would it be possible to get the example codes of a custom page template and the according php file? I have to admit I don't get very far with the above, sorry. Thanks a lot for some examples.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.