Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-17 15:44:09

Sai
New Member
Registered: 2008-01-17
Posts: 6

Different design for every Section

Hi,
I have a problem with my website design.

My site has 6 sections, whose links are visible above the text all the time.
Now I want to use a different design for every section, meaning the backgroundimage in changes whenever I click on another section-link.
My idea is it to use if_else, but here comes the problem:
I can only constitute 1 if-condition and 1 else, but I need actually 5 cases and 1 else.
I believe I did not undestand the txp:if_section- command correctly, so would you please help me out?

Here is my try:

<div id=“center”>
<txp:if_section name=“cv”>
<div id=“container_cv”> </div>

<txp:else />
<div id=“container_donwloads”> </div>
</txp:if_section>
</div>

(it works like that)
I designed 6 different container-boxes, so I’d like to go on like
<txp:if_section name=“links”> <div id=“container_links”> </div>
<txp:if_section name=“impressum”> <div id=“container_impressum”> </div>
etc.

(i erased the content of the container-boxes as they are not part of my problem)

Offline

#2 2008-01-17 15:46:15

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Different design for every Section

You could give the background image for a section the same name as the section itself, so if you want the right background image, you’d use /path/to/<txp:section />.jpg

Offline

#3 2008-01-17 16:13:01

Sai
New Member
Registered: 2008-01-17
Posts: 6

Re: Different design for every Section

I should have mentioned that I’m pretty new with the whole CSS / TXP thing.

Where would I use the term
/path/to/<txp:section />.jpg
?

In the css-file?

Assuming my pictures are in the folder /html/test/images/css,
textpattern in /html/test/texpattern.
What would I have to write?

I renamed the files and tried the code: (css-file)

#container {
width: 936px;
height: 670px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
background-image: url(../images/css/<txp:section />.png);
}

It does not work like that.

Last edited by Sai (2008-01-17 16:14:08)

Offline

#4 2008-01-17 16:46:58

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Different design for every Section

One simple solution might be create a custom style for each section and then create a custom page for each section that includes a link to the style. Not as elegant, perhaps, but easily well within the capabilities of TxP.

Offline

#5 2008-01-17 16:58:23

Sai
New Member
Registered: 2008-01-17
Posts: 6

Re: Different design for every Section

@michaelkpate:
I actually wanted to avoid that, because I’m still working on the css file and probably will be for a long time. So it’s very unefficient to change every single css-file whenever I have made some adjustments though I just want to have a different bg picture.

Offline

#6 2008-01-17 17:04:29

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Different design for every Section

If you have this in your CSS:

.container {
  width: 936px;
  height: 670px;
  margin: 0px 0px 0px 0px;
  padding: 0px 0px 0px 0px;
}
#container-section1
{
  background-image: url(../images/css/section1.png);
}
#container-section2
{
  background-image: url(../images/css/section2.png);
}

Then in the actual page/template you’d have:

<div class="container" id="container-<txp:section />">

Offline

#7 2008-01-17 18:28:12

Sai
New Member
Registered: 2008-01-17
Posts: 6

Re: Different design for every Section

Hah, ruud, you made my day! :)
Thanks alot!

Now there’s only one thing left:

I want the home-section (which I did not create, but I think it’s somewhere, as I can create a link_to_home) to be the only one which displays the time of every post. I don’t get that to work, b/c I don’t know how to call upon the home-section and where to descripe the article form for that.
(Hope you can understand that, it’s quite dfficult for me to describe it)

Offline

#8 2008-01-17 18:41:13

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Different design for every Section

I fear you’ve lost me there.

Offline

#9 2008-01-17 20:00:23

Sai
New Member
Registered: 2008-01-17
Posts: 6

Re: Different design for every Section

Ah ok, it works now. I had to change the standard css and template.
Thank you for your effort!

Offline

Board footer

Powered by FluxBB