Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello there!
I downloaded couch just this evening, I'm not a proffesional web developer, just a humble little hobbyist making a website for myself. I must say it's very friendly and easy to use even for a noob like me :p

Anyway, so I got a clonable template that has a few cloned pages. So far, so good. But of those cloned pages there's one that needs to use a unique line of code, just on that page.

Basically, I just need to insert this little code
Code: Select all
style="margin-left: -100px;"

into an img tag. The image on this particular page needs to be positioned a little differently than on the other pages.

I tried looking through the documentation and attempted a little (failed) guessworking involving the "if" tag.

Thanks in advance!
Hello,
It's a very easy task - every page in a Clonable template has a unique id, to find it just place this code into your template (or use cms:dump) :
Code: Select all
<cms:show k_page_id />

Then open the page you need to place your custom style and look at the number. For example, "27". As soon as find it, can delete this line.
Now add a condition to the image:
Code: Select all
<img src="image.jpg"<cms:if k_page_id='27'> style="margin-left:-100px"</cms:if> />

The full list of available variables is here: http://www.couchcms.com/docs/concepts/v ... views.html
Hello and welcome pitchpurple :)

I'd like to add one little thing to musman's solution -
In addition to a page's id, its name (not title, mind you) is also a unique identifier.

The name can be easily seen while editing any page in the second textbox from top.
So with the name known, the following code will also work -
Code: Select all
<img src="image.jpg"<cms:if k_page_name='whatever-name'> style="margin-left:-100px"</cms:if> />
Ah, that did the trick, thank you!
4 posts Page 1 of 1
cron