Welcome Guest, Not a member yet? Register   Sign In
CxTags question
#1

[eluser]mistafran[/eluser]
I've been playing around with the CxTags for a couple of days now. I was just wondering if there was a way of listing all blog posts with their associated tags e.g:
t
Post Content
Tags: test, tag
----------------
Post 2
Post Content 2
Tags: test, tag
----------------
Post 3
Post Content 3
Tags: test, tag, category

the function fetch_tags() seems to want a row id but I cant seem to think of an easy way to combine with my function to get all posts.

any help will be appreciated.

Many thanks
#2

[eluser]dodd[/eluser]
I'm also having problems with this. I can identify associated tags for each row id.

but I am having trouble building this into the function that displays all posts as will need to pass back the tags to the array data for the view in order to display using foreach in the view.

Any pointers on how to achieve this would be much appreciated.
#3

[eluser]mistafran[/eluser]
What I did to fix this was to return all Tags from the DB.

I then used this code in my view to output only the correct tags for each post.
Code:
<?php foreach($tags->result() as $tag):?>
         <?php if ($tag->RowId == $row->PostId):?>
            <li><a href="#">&lt;?php echo $tag->Tag;?&gt;</a></li>
         &lt;?php endif; ?&gt;
       &lt;?php endforeach;?&gt;

it's a bit messy, if anyone knows of a cleaner way to achieve this, i'll be glad to hear it
#4

[eluser]dodd[/eluser]
Thanks. it would be nice to move some of that out of the view ideally. I'll let you know how I get on.




Theme © iAndrew 2016 - Forum software by © MyBB