Forums / Cotonti / Extensions / Support / Show all tags

musashi9
#1 2012-11-02 04:29

How do I show related tags on a page?

Example, right now I make a page and and give it a tag of BALL and when I view this page it shows the link to the tag BALL and I click BALL and I see all related pages.

How do I get a page to show links to all related pages instead of just a link to BALL

This post was edited by musashi9 (2012-11-02 06:05, 11 years ago)
Twiebie
#2 2012-11-02 07:04

Is this maybe what you are looking for, http://www.cotonti.com/extensions/navigation-structure/similar_pages?

No idea if it works though.

musashi9
#3 2012-11-02 10:56

No , I want it to work with TAGS LIST

Macik
#4 2012-11-02 11:28

If you used tags plugin you can use this link to show page with list all articles related to specified tag-list (for example tag2, tag3, tag4)

index.php?e=tags&a=pages&t=tag4%2C+tag3%2C+tag4

In your case this link shuold be: index.php?e=tags&a=pages&t=BALL (you get page with list of all ralated pages with tag BALL)

If you want to add "List of related pages" right in the source page it needs to be made with plugin or extension of TAGs plugin.

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
musashi9
#5 2012-11-02 11:32

I want it to display inside my page and not a seperate page

Kingsley
#6 2012-11-02 11:47

I think that the similar pages plugin doesn't get it's info from the tags, but from the title. Think there is no cotonti plugin for displaying pages with similar tags. However, you can use this plugin:
http://www.cotonti.com/extensions/navigation-structure/pagelist

I believe this plugin (haven't worked with it yet, so this part is a maybe) is meant to give you options to achieve what you want in a fairly easy way.  Correct me if I am wrong, anyone..

GHengeveld
#7 2012-11-02 12:00

Try this:

<div id="relatedpages">&nbsp;</div>
<script type="text/javascript">
$(function(){
  $("#relatedpages").load("index.php?e=tags&a=pages&t=YOUR_TAG ol:first");
});
</script>

This should load a list of related pages into your page, based on the given tag. Replace YOUR_TAG above with the tag you want to use.

Note that this solution uses ajax to load the contents of the regular tags page into your page. The same could be achieved with PHP instead of Javascript, but that would require a plugin. Perhaps we can introduce a tpl callback function which mimicks jQuery's load() function, allowing you to do something like this:

{PHP|load("index.php?e=tags&a=pages&t=TAG", "ol:first")}

Actually, the above can probably already be achieved by using file_get_contents() as a callback, although that will give you the entire HTML page, not just a section of it:

{PHP|file_get_contents("http://www.google.com/")}
musashi9
#8 2012-11-02 15:30

@Kingsley Is this tool for developers only? I installed it but I don't knwo what to do with it.

@GHengeveld Nothing happend for me, plus I want it to be on all of my pages (getting its own tag name, from the tag plugin) and not for me to manually enter the tag name myself

 

Macik
#9 2012-11-04 23:19
<!-- IF {PHP|cot_plugin_active('tags')} AND {PHP|cot_plugin_active('pagelist')} -->
      {PHP.tags|implode('","',$this)|pagelist('pagelist',5,'','page_id in (SELECT tag_item FROM `cot_tag_references` WHERE tag in ("$this"))','','system;archive','','pll',1)}
<!-- ENDIF -->

will work only in latest version from «trunk» and TAGS and PAGELIST plugins installed.

But it not a «true way» and very unstable.

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
Kingsley
#10 2012-11-05 00:34
#36079 musashi9:

@Kingsley Is this tool for developers only? I installed it but I don't knwo what to do with it.

Nope, as I understand it enables you in a fairly easy way to add all kinds of stuff into pages and lists. For example you have a gaming news section, and with this plugin you can create a widget that displays a list of other gaming news on your page, or recent news, etc..
Havent played around with it yet, but I admit that it kinda needs (a bit) advanced knowledge of php? or something similar.

 

musashi9
#11 2012-11-05 10:35
#36118 Macik:
<!-- IF {PHP|cot_plugin_active('tags')} AND {PHP|cot_plugin_active('pagelist')} -->
      {PHP.tags|implode('","',$this)|pagelist('pagelist',5,'','page_id in (SELECT tag_item FROM `cot_tag_references` WHERE tag in ("$this"))','','system;archive','','pll',1)}
<!-- ENDIF -->

will work only in latest version from «trunk» and TAGS and PAGELIST plugins installed.

But it not a «true way» and very unstable.

I get this error with my pages now.

PAGE IS UNAVAILABLE DUE TO TECHNICAL REASONS

I guess I need to copy some files from trunk (if so which files)? Is it worth the hastle or should I just wait for a proper plugin ?

Macik
#12 2012-11-05 18:59

This trick uses TAGS and PAGELIST plugins, so its should be installed. And you need at least new cotemplate.php file, thus arrays processing was fixed there.

Before tests make a backup copy for sure.

 

As for propper plugin - try to open «issue» on GitHub with request to extend TAGS plugin.  

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
musashi9
#13 2012-11-05 23:25

Ok, great thanks