Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
So I'm currently setting up my site, and I ran across a small problem.

The way my "blog" is formatted, I want to be able to use around 3 different templates for my blog - This one:
http://codeostudio.hr/premium/themeforest/imagpress/post.html

This one:
http://codeostudio.hr/premium/themeforest/imagpress/post-full-width.html

And one more that I customized for my needs.

So, is there any way with CouchCMS that I can, when creating a post, choose whether or not to use one of these specific templates? Any way at all?

Thank you!
jsonicx9 wrote: So I'm currently setting up my site, and I ran across a small problem.

The way my "blog" is formatted, I want to be able to use around 3 different templates for my blog - This one:
http://codeostudio.hr/premium/themeforest/imagpress/post.html

This one:
http://codeostudio.hr/premium/themeforest/imagpress/post-full-width.html

And one more that I customized for my needs.

So, is there any way with CouchCMS that I can, when creating a post, choose whether or not to use one of these specific templates? Any way at all?

Thank you!


Hi jsonicx9!

Lets say your blog handled by a clonable template name "blog.php", and you already declare needed tag for your blog.

Now try to add this code on your "blog.php" :
Code: Select all
<cms:editable
      name='blog_layout'
      label='Blog Post Layout'
      desc='Choose your post layout'
      type='dropdown'
      opt_values='Boxed=1 | Wide=2'
      order='1'
   />

I put "order='1'" so it will show on top of another, so you will choose the layout before you fill the other field.

Now, create 2 files, "blog-boxed.html" & "blog-wide.html" and copy your single post template on that according on your single post layout, and put it on your "snippets" folder.

Assuming you follow this docs, to create your blog, we will modify the page view to :
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

<cms:template title='blog' clonable='1'>

   <cms:editable
      name='blog_layout'
      label='Blog Post Layout'
      desc='Choose your post layout'
      type='dropdown'
      opt_values='Boxed=1 | Wide=2'
      order='1'
   />
   
   <!-- Your Other Blog Editable Fields -->

</cms:template>
<cms:if k_is_page>
   <cms:if blog_layout = '1' >
      <cms:embed 'blog-boxed.html' />
   <cms:else />
      <cms:embed 'blog-wide.html' />
   </cms:if>
<cms:else />
   <cms:embed 'blog-list.html' />
</cms:if>
<?php COUCH::invoke(); ?>



Now, before you post someth on your blog, you need to choose the single post layout, or according to the code, you will have a default Boxed Layout.


Thx!
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
@GoingMarryAsap The code works great, there's just one small problem.

If I select one of these options, instead of just setting the blog to match the template of the option I chose, it does that... and then proceeds to put a page under that one that matches the template of the other option. I really don't want that.

Might there be something I overlooked? Or, maybe you could take another look at your code?

Ago tibi gratias.
@jsonicx9, @GoingMarryAsap's code seems fine to me.

Could you please post the exact code you are using? Perhaps it has some logical error in it.
jsonicx9 wrote: Might there be something I overlooked? Or, maybe you could take another look at your code?



KK wrote: @jsonicx9, @GoingMarryAsap's code seems fine to me.

Could you please post the exact code you are using? Perhaps it has some logical error in it.


Hi Mate!

Just like KK said, please you post your code here? So we can debug it together with KK ;)
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Wait, never mind, guys, I've got everything fixed now. Just had a few kinks in the code.
6 posts Page 1 of 1
cron