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.

Different weblog layouts

July 24, 2010 1:17pm

Subscribe [3]
  • #1 / Jul 24, 2010 1:17pm

    hannastone

    8 posts

    Hi all,

    Is there a way in EE 1.6 to have multiple layouts for weblogs?
    On my current blog I have an image (custom field) that goes with each entry a but is there a way of say every second or third post could only have the title of the entry and not the image?

    I tried the “if/else” way of doing it but I failed… At the moment I have to offset each post and it’s a major pain and a silly way of doing it.

    Does anyone know if that’s possible?

    Thanks and hope I made sense 😊

    Regards,
    Hanna

  • #2 / Jul 26, 2010 4:35am

    awa

    77 posts

    Hi Hanna,
    what about the {count} variable.
    See
    http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_count

    Maybe you can use a conditional like

    {exp:channel:entries}
    {title}
    {if count =="2" OR count =="5"}
    {if:else}
    {my_custom_field}
    {/if}
    {body}
    {/exp:channel:entries}

    That should omit the image for the 2nd and 5th entry. If you add another entry the old no 1 (with image) becomes the new no 2 (without image).

    awa

  • #3 / Jul 26, 2010 3:13pm

    Boyink!

    5011 posts

    Or just create another custom field in your blog - say “show_image”.

    Then in your template do something like:

    {if show_image=="yes"} 
       {my_image}
    {/if}
  • #4 / Jul 26, 2010 3:47pm

    hannastone

    8 posts

    Hi awa and Boyink!

    awa: Thanks for the code, I tried the code and got an error, Isn’t channels for EE 2.0? I am running 1.6

    Boyink: Again thanks for the code, the design I have is a bit mental and I more or less wanted to create a grid style site with different weblog layouts (different background colours and text sizes ect.) I wanted to keep it as simple as possible with the code, at the moment I have loads of code with loads of “offset’s” set for each weblog.

    I tried your code but don’t think it’s what I am looking for (but I will used it for laters 😊

    Thanks and sorry for the silly questions.

    Hanna

  • #5 / Jul 26, 2010 4:44pm

    Lisa Wess

    20502 posts

    Check out {switch=}

  • #6 / Jul 26, 2010 5:05pm

    Boyink!

    5011 posts

    Boyink: Again thanks for the code, the design I have is a bit mental and I more or less wanted to create a grid style site with different weblog layouts (different background colours and text sizes ect.)

    Hanna

    The other thought there then is to create fields for every aspect of the blog entry that you want to have change - a field for background color, a field for text size, etc - then feed those into the template as inline styles.

  • #7 / Jul 27, 2010 3:58am

    awa

    77 posts

    Isn’t channels for EE 2.0? I am running 1.6

    Hi Hanna,
    your´re right. Pls replace channel with weblog.
    Regarding the design: Do you want to have a certain layout associated with a certain posting? Then Michaels suggestion is desinitely a good way to solve the problem.
    Or do you want to format a certain position on your page formatted in a special way. E.g. 1st post has a picture, 2nd post no picture, but bold headline.
    Then you should look into the options, that Lisa and I suggested. Here the formatting is tied to the layout and not to the post.

    Both are valid options.
    Cheers
    awa

  • #8 / Jul 27, 2010 3:47pm

    hannastone

    8 posts

    Hi awa,

    YES!!!! it work!!! woohoo!! I changed channels for weblogs as you said and it worked! This now means I can make crazy layouts without having to offset every single post. Yet another reason why EE is the best CMS there is!

    Thanks to everyone who took the time to help me!

    You are all amazing!

    X

    Hanna

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

ExpressionEngine News!

#eecms, #events, #releases