Category / Tag GUI -- Assigning to content

edited December 2013 in Installation
I've enabled the generic tags and categories modules per http://docs.getfuelcms.com/general/tags-categories

I've also created a number of tags and categories successfully via the Fuel interface.

My question however is this:
How do I assign these tags and/or categories to pages?
/fuel/pages/edit/[id #] doesn't seem to have a way to add them to the content.

Do I have to custom code in that ability?

Comments

  • edited 10:50AM
    I've settled on this at least for now:

    My_fuel_layouts.php
    $tagOptions = $this->fuel->tags->options_list();

    and added to 'fields' this: 'tags' => array('type' => 'multi', 'sorting' => TRUE, 'mode' => 'checkbox', 'label' => 'Tags', 'options' => $tagOptions),

    It would be nice to pull all categories, and then look up what tags belong to each and print them off. And a final pull for tags that didn't belong to a category.
  • edited 10:50AM
    Your current solution would be the way to implement it at this point. How are you using these tags and categories on your website?

    If you associate a category to a tag in the CMS, you will be able to access all the tags associated to that category:
    $categories = fuel_model('categories'); foreach($categories as $cat) { foreach($cat->tags as $tag) { echo $tag->name; } }
  • edited 10:50AM
    The idea is that pages are tagged, and most tags will belong to a category.

    That will allow sorting / pages with particular tagged/categorized content
  • edited December 2013
    I've managed to put together a display that works well:

    Outputs
    [Parent Cat. Name] -> [Category Name] -> [Tag Name]
    And uses the $tag->slug for the layout variable value

    $tagOptions = array(); $categories = fuel_model('categories'); foreach($categories as $cat) { if($cat->parent_id != 0){ $parent = $categories[$cat->parent_id -1]->name." -> "; } foreach($cat->tags as $tag) { $tagOptions[$tag->slug] = $parent.$cat->name.' -> '.$tag->name; } }
Sign In or Register to comment.