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.

newbie date problem and category group

June 25, 2007 11:32pm

Subscribe [1]
  • #1 / Jun 25, 2007 11:32pm

    ummedia

    466 posts

    Hi
    I have two newbie questions that I think should be working but are not. I may have messed up the installation.

    The first one is I cant seem to get any date tag to work for example I am using {entry_date format="%Y %m %d"} and I thought it should return the date I have tried other date options and they dont seem to work they just show the typed TAG. I have other code working in that entries query so I assume its something I have done.

    The second one is should {category_group} always return the category group of that category(how does it know that category?). In fact could someone point me to some code that shows this working. I think I may have not understood what this tag does.

    any help greatly appreciated

    regards


    Adam

  • #2 / Jun 27, 2007 1:03am

    ummedia

    466 posts

    Maybe I didnt write this properly

    My {entry_date format="%Y %m, %d"} does not return anything, I may have broken EE when updating could someone from EE give me some advice please. I just want to return the submitted date within an entries tag.

    Once you know what category you are using is it possible to ask the group ID of this category?

    many thanks

    Adam

  • #3 / Jun 27, 2007 1:08am

    Lisa Wess

    20502 posts

    Can you give us the entire template, so that we can see what might be going on?  For instance, the entry_date is only a valid variable inside a few tags, such as the {exp:weblog:entries} tag.

    You should be able to query the category group.  Again, what tag are you using and in what context do you need this information?

  • #4 / Jun 27, 2007 1:31am

    ummedia

    466 posts

    Thanks forr a speedy response Lisa. I will do my best to give you the info you need.
    For a start I am using Freeway with EE and although it makes templates stupidly easy I dont think that many people are using it so help is limited(basically I dont have to do too much code within freeway)

    Anyway the code from the generated from the freeway file is this

    {entry_date format="%Y %m, %d"}</span>
                  {smallimage}
    {titleofart} by {artistname}
                  {/exp:weblog:entries}

    which I can see has " instead of “” marks I assume this is why it is not working If it is I finally have something I can take to the freeway forum and find out how to get it to actually generate the quotes.

    The category group problem is different as I can get it working with an actual entry but not when I retrieve using mysql query. Do you know where(what field that information is kept in) for example exp_category_posts.cat_id, exp_categories.cat_name is how you return a category ID and a Category name, but exp_categories.cat_group doesnt return the category_group.

    Actually, as I now have the Category name{cat_name}is it possible to ask the group of this.

    When I read this category but back I could make no sense of it so I dont know how you will. If you get it at all or need more specific info could you leet me know

    again many thanks for your help


    Adam

  • #5 / Jun 27, 2007 1:36am

    Lisa Wess

    20502 posts

    Adam - in your initial code block (btw, you can use [ code ] ... [ / code ] (nix the spaces between the brackets) to post in codeblocks):

    {entry_date format="%Y %m, %d"}</span> 
    <a href="http://{path=">{smallimage}</a>
    <a href="http://{path=">{titleofart}</a> by <a href="http://{path=">{artistname}</a> 
    {/exp:weblog:entries}

    Where is the opening weblog entries tag?

    I am actually not particularly good with SQL queries - in fact way back in the day I started using CMS’s to avoid programming.  I would recommend bumping your other post to see if anyone else has some more ideas for you.

  • #6 / Jun 27, 2007 1:56am

    ummedia

    466 posts

    sorry Lisa my bad

    {exp:weblog:entries weblog="artistwork" limit="3" orderby="entry_date"}
                        <span class="style3">Artwork uploaded
    {entry_date format="%Y %m, %d"}</span>
                        <a href="http://{path=">{smallimage}</a>
    <a href="http://{path=">{titleofart}</a> by <a href="http://{path=">{artistname}</a>
                        {/exp:weblog:entries}

    Now the funny thing is that freeway uses " instead of ” around the date code, but when you reposted my code it was normal. Maybe this isnt the problem. I will try to test.

    Where can I bump my code to? I also would prefer not to code pretty pictures are my thing

    regards

    Adam

  • #7 / Jun 27, 2007 2:02am

    ummedia

    466 posts

    Lisa
    It was the " being used instead of just ” I hand coded it and it worked fine, I will post on the freeway forum to see if I can get iot to stop doing that. Where do I post the SQL question?

    thanks for all your help

    regards

    Adam

  • #8 / Jun 27, 2007 2:04am

    Lisa Wess

    20502 posts

    Didn’t you have another post with a sql query you were working on with this category group thing?  If not, a new post with a good description and code would be a good beginning.

    I would make sure to re-type this directly into your template to rule out Freeway.  I have never used that program so can’t speak to any problems it might have.  Do you have a link to where you are having the problem? What is being output?  Oh, and I see now what you mean the the quotes - definitely retype those directly into the template, that could easily be the problem.

  • #9 / Jun 27, 2007 2:15am

    ummedia

    466 posts

    The page is here and works brilliantly

    http://www.ummedia.com/MY_SITES/fatlava/EE/index.php/intelart/categories/

    All the categories are returned and their total amount. I would just lie to be able to separate them furthe into their groups as in the end there could be a lot of categories.

    This is the code I am using(and its all hand coded so freeway does not have any influence over this. I think the problem may be in what I am asking of sql as in I am not asking for the category group, but as I dont know what it is within EE I cant.

    <table><tr>
    {exp:query sql="SELECT count( exp_category_posts.entry_id ) AS count_1,
    exp_category_posts.cat_id, exp_categories.cat_name
    FROM exp_categories, exp_category_posts
    WHERE exp_category_posts.cat_id = exp_categories.cat_id
    GROUP BY exp_categories.cat_name"}
    <td width=169 height=93 valign=top><a href="http://{path=intelart/category}C{cat_id}/">http://www.ummedia.com/MY_SITES/fatlava/Resources/suitcase.gif</a>
    {cat_name} ({count_1})</td>
    {if {count} == "4"}</tr><tr>{/if}
    {if {count} == "8"}</tr><tr>{/if}
    {if {count} == "12"}</tr><tr>{/if}
    {if {count} == "16"}</tr><tr>{/if} 
    {if {count} == "20"}</tr><tr>{/if}
    {if {count} == "24"}</tr><tr>{/if}
    {if {count} == "28"}</tr><tr>{/if}
    {if {count} == "32"}</tr><tr>{/if} 
    {/exp:query}
    </tr></table>

    again thank you

    regards

    Adam

  • #10 / Jun 27, 2007 2:17am

    Lisa Wess

    20502 posts

    Adam - lets focus on the entry date here, which is what I was referring to. Lets get this category stuff into a dedicated post. =)

  • #11 / Jun 27, 2007 2:26am

    ummedia

    466 posts

    thats what I was doing entry now works and thank you, all I was asking was where to put the new post is there somewhere different for sql query questions. This post was up before but didnt get any takers it was the way I had written it I know, but its very difficult wording everything correctly when you aren’t a whizz with EE or a programmer. I’ll try again in ‘How to’ and try and word it differently.

    regards
    Adam

  • #12 / Jun 27, 2007 2:30am

    Lisa Wess

    20502 posts

    Adam - try not to work anything with the SQL.  Instead, describe *what* you want to do.  For instance.

    ___

    I want to create a list of categories and have the Category Group as the heading of the categories.  I also need to include the category count after each category, ie:

    Animals
    - Horses (28 posts)
    - Dogs (35 posts)
    - Cats (6 posts)

    where “Animals” would be the name of the Category Group.

    Can someone help me with this? thanks. =)

    ___

    That way people don’t have to try to guess your goal from some code, and you don’t have to worry about your level of expertise in programming.

  • #13 / Jun 27, 2007 2:41am

    ummedia

    466 posts

    Ok Thank you Lisa I will try that.

    many thanks Adam

  • #14 / Jun 27, 2007 3:05am

    ummedia

    466 posts

    Thanks Lisa I wrote the post and posted it then thought I really dont want to start again so i went into mysql and had a look scary though it was I worked out where my information was and how to get it. I can now view my category group using the query. Thank you again for inspiring me. I now need to remove my post and work out how this {if}{/if} works.

    regards

    Adam

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

ExpressionEngine News!

#eecms, #events, #releases