Hardcoding Tags with links into Page Template

Hi There

I need to use tags so I can cross link articles to other relevant content on the website.

I have added the tag attribute in page tags. I have then tried in both a page default and on specific pages adding the Tag block to the sidemenu. However when I add this block it shows no tags. However when I hardcode the tags call into my template such as

Related Articles: <?php echo $c->getAttribute('tags') ?>

It presents the tags fine.

Anyway, so I don't think that provides enough info for people to help fix that - and it may be a config thing my end, but I cannot find it.

HOWEVER - what I realise is I would much rather just hardcode this into a template, however with the hyperlink queries off to a search results page. Sadly my coding skills are really only up to copy and paste - can anyone enlighten me as how to call a page's tags and link to those tags within the page template?

Would really appreciate your help

irsah replied on at Permalink Reply

I think this could be useful (by CMSCSS)


Use the tags block full embedded code and reference to the desired url. I'm not a coder/developer, and like you, sometimes these cool snippets just open up eyes (with some tweaks).

You could change in the middle section of the above code to refer it, but a little more work though in getting the proper call as required. You could also add hyperlink switching within the code itself.

IMO (from the top of my head...)
tobyme replied on at Permalink Reply
Thanks alot for the reply - that's really helpful - bookmarking that post.

One question though, I use that code but how do I then call that output and print it into the page because - <?php echo $c->getAttribute('tags') ?> just calls the standard output I had before, seemingly by getting the unprocessed output.

SO I need to tweak the call, but to what? I need to get to grips with these php calls in C5 as it really holds me up. Any help would be great
tobyme replied on at Permalink Reply
UPDATE - really bloody confused, please help if you are a detective. I have been through most options and am stumped. I am experience with C5 so very confused.


> I have entered the tag attribute into attributes and to the page as per the C5 manual
)checked against this post -http://www.concrete5.org/community/forums/usage/tags-invisible/)...
> I have added the tags block to my page. I see it in the page and the heading is there.
> In edit mode the tags block editor overlay shows the tags for that page in the Tags field if Display Tags for the current page is checked
> I publish the block and the page
> There are no tags shown, just the block heading
> checking on firebug - there is just no output. Just

<div class="ccm-tags-display">
<h4>Related Articles</h4>
<div style="clear: both"></div>

>on the parent page where a pagelist calls the childs page tags, it displays the tags for my page so I am confident / certain the tagging system is setup correctly as both the block in edit mode and the parent page in a page list can detect the tags, just not the Tag block.

Final two things >

>I have tried hardcoding in the block to no avail


Call to undefined method TextAttributeTypeController::getOptions() in mysite/public_html/concrete/core/controllers/blocks/tags.php

This may hint at a problem

I have also tried:
> changing the page template & theme but the same happens on plain yogurt.

Any suggestions hugely welcome!
irsah replied on at Permalink Reply
Oops I think my previous reply came after this one.

Did you assign your "search page" with a search block installed in the main area?

And also the tags handle could not be recognised (as so you have not installed, but you actually created the handle though). Cleared cache entirely, dashboard and working browser several times after tweaking?
irsah replied on at Permalink Reply
Copy the entire code, changes/output can be made ie.:

$tagsBT->controller->displayMode = 'cloud';//displays all available tags
$tagsBT->controller->displayMode = 'page';//displays tags for a certain page

and it will display the current page tags assigned. Just read on the comments stated in each line of code and you can tweak it a bit.

If you still want to use Tags functionality, the target url for the tags must have a search block in it. Example in line $targetPage = Page:getByPath('your_page_end_url_with_a_search_block_installed_in_main_area');

So I think it is possible to tweak to your desired output when hyperlinking the available tags to a certain page you assign to. In that page (if not a coder) insert pagelist block and assign certain views/pages with the tags you required.

Or else, you can tweak Tags block by copying the core block to your_domain/blocks/tags/templates, and tweak it's output querying via the search result. So you will have a special tags template for the hyperlinking feature.

But by doing this, for a particular tag/s hyperlinking would be best, but when you have a plenty to link to, then it's not the way to go. Hardcoding would be my best bet, especially on the tags output.

For me I just tweak the search block to display page images attribute for each tags hyperlinking from my blog page, so it will look like it came from a certain category for that page. You can have a look of the results herehttp://www.irsah.com/category-search/?query=concrete5...

Hope it helps.
tobyme replied on at Permalink Reply
Thanks for taking the time to reply.

To be clear I am trying this with both your hardcode and with the block and neither works.

Sadly yes, I have setup a page ../search-results and it has a search block added in it in the main area. I have tried it in the sidebar too. I still don't seem to get any love.

I have tried resetting it up and moving it in the sitemap and all sorts. Still nada.

To be clear its just a standard search block yes?
irsah replied on at Permalink Reply
Sometimes I get that too.. but the code (by CMSCSS) works, and I use it (embed)on my web. Sorry can't give more clues but will forward you if I get to come across something.

tobyme replied on at Permalink Reply 1 Attachment

Right massive thanks to irsah for his help. maybe I was being slow but I completely missed some of the steps so I am going to share here for others.

To add a tagging system to your page to allow you to cross promote posts of similar content:

1 - Download and install the Page Selectot addon (http://www.concrete5.org/marketplace/addons/page-selector-attribute/). I totally issed this and I swear its not mentioned anywhere.

2 - Add the page attribute 'tags' - selector class into your page attributes, and then on the relevant posts add the necessary tags in the page properties.

3 - Create a search results page of its own with a search block in the main area.

4 - on your page (or in the page type defaults / or hardcoded) add in the tags block, ensure the destination is the page you created above in step 2

5 - now you should have a basic tags setup, however if like me you dont want a search box above your results on the results page you will need to create a custom template for your search box

6 - duplicate the file view.php in the concrete/blocks/serach folder and place it in a new folder structure ../blocks/search/templates/results (you need to create the search, templates and results folders)

7 - plonk your view.php duplicate from the concrete core search folder into the folder results folder. Paste what I have attached which very basically adds hide classes to search elements to stop that displaying and only showing results.

FYi as per previous posts you can hardcode and then reformat the tags etc etc.

This is clunky as arse and hopefully will be improved in future updates because this is where wordpress proponents would get all smug and it could easily work out of the box.

Good luck and thanks again for the help.
irsah replied on at Permalink Reply
Your welcome, glad to assist.. hope it helped..