ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Category Problem

April 30, 2011 4:59pm

Subscribe [2]
  • #1 / Apr 30, 2011 4:59pm

    Luke D.

    12 posts

    Hi, I’ve been a Codeigniter developer for years, am new to ExpressionEngine.

    I’m working on my first EE site. I’ve set up a channel called Galleries, which will be showing images organized into galleries. I have set up a bunch of categories for it, about 8 or 9 categories thus far. I’ve got everything assigned properly, or so I think, and everything else on my site is thus far working fine. Really, this isn’t hard software to use, but this category thing isn’t working at all.

    The code below, while the url changes accordingly, the h3 tag within the category_header tag shows no output - this code doesn’t work. I pulled this right out of tutorials. what am I doing wrong here? In Global Channel Preferences I’ve got it set to use URL Titles in links, my restricted trigger word is ‘categories.” Any ideas? I feel like a moron.

    {exp:channel:category_heading channel="galleries"}
    <h3>{category_name}</h3><p> <br />
    {/exp:channel:category_heading}</p>
    
    <p><br />
    <ul></p>
    
    <p>{exp:channel:categories channel="galleries"}</p>
    
    <p><a href="http://{site_url}main.php/art/{category_name}">{category_name}</a></p>
    
    <p>{/exp:channel:categories}</p>
    
    <p></ul>

    It doesn’t work if I subsitute “category_url_title” for category name either.

    Luke

  • #2 / Apr 30, 2011 7:01pm

    tidy

    196 posts

    Hi Luke,

    I think the issue might be with the URL you are accessing the category pages on.

    Try changing the href link in your categories tag to this format:

    {exp:channel:categories channel="galleries"}
    <a href="http://{path=templategroup/template}">{category_name}</a>
    {/exp:channel:categories}

    EE will build the category links automatically, so this code will output links to templategroup/template/category/category-name

    Change templategroup/template to whatever they should be for your site. It looks like you have either a template group or template called art here. I’m not sure where you are getting the main.php bit from. EE links don’t tend to have file extensions in them. As a rule of thumb, in EE you either have your hrefs set to

    path='template-group/template'
    (or
    title_permalink='template-group/template'

    when linking to individual entry pages like news articles)

    If the revised categories tag code above does not fix things, let us know what URL you are viewing when the h3 is not working, and also try putting an exp:channel:entries loop below your existing template code to check whether the images in the category are being listed out at least.

  • #3 / Apr 30, 2011 8:30pm

    Luke D.

    12 posts

    Janine,

    Hey,thanks. That fixed it.

    The main.php is there because I’m building this site beside to a codeignitor site which also uses index.php in the urls. What I wasn’t doing was using the path variable, though, and that made the difference. EE is has got a lot more under the hood when it comes to processing URL’s than codeigniter. What I know about CI is in some cases getting in my way.

    At any rate, I owe you wine, beer, chocolates, granola, etc. thanks!

    Luke

  • #4 / May 02, 2011 4:33pm

    Lisa Wess

    20502 posts

    Thanks for the assist, Janine!

    Glad that helped, Luke. If anything else comes up, please go ahead and post a new thread. =)

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases