Loading...
 
Skip to main content

Themes


Strange interaction between tpl and css?

Greetings!
I am trying to modify a template (tikipedia) to use on my site. So far so good, but I have a behavior I can't understand.

The top_bar.tpl template puts a copywrite/community notice and the date and time onto the right column. The date and time links to the calendar. Unfortunately in my color scheme it is impossible to read, so I wanted to change the colour.

To do this I created a new style. Old style is "a", so I created an exact duplicate with a different name (I tried "a2" and when that didn't work, in case single letters were magic, I tried "t". The style is identical except for color (cut and pasted).
Then I changed the <a> and </a> to the new style.
The color is fine now, but the link is broken.

Changing it back to "a" reestablishes the link. The one letter change breaks it. I even went back and made "t" EXACTLY cut and paste identical, same colours etc. in case I'd dropped a ";" or something, and it still has the link with "a" and no link with "t".

What am I missing please? I guess I can just make a separate calendar link, but I thought it was an elegant way to do it. And I'm just befuddled and keen to learn what it is that I don't understand in this case (my ignorance is, admittedly, vast!)

Thanks for the help!
Philip
Chang

> Greetings!
> I am trying to modify a template (tikipedia) to use on my site. So far so good, but I have a behavior I can't understand.
>
> The top_bar.tpl template puts a copywrite/community notice and the date and time onto the right column.

I assume you mean in your modified version, as Tikipedia normally uses a left column and main column.

>The date and time links to the calendar. Unfortunately in my color scheme it is impossible to read, so I wanted to change the colour.
>
> To do this I created a new style. Old style is "a", so I created an exact duplicate with a different name (I tried "a2" and when that didn't work, in case single letters were magic, I tried "t". The style is identical except for color (cut and pasted).
> Then I changed the and to the new style.

I'm not sure what you mean by this changing of the anchor tag. The HTML tag syntax shouldn't be changed for color-adjustment purposes, especially if CSS is being used to specify the color.

> The color is fine now, but the link is broken.

The link color change can be made in CSS alone, which wouldn't touch the HTML code so how the link works shouldn't be affected.

> Changing it back to "a" reestablishes the link. The one letter change breaks it. I even went back and made "t" EXACTLY cut and paste identical, same colours etc. in case I'd dropped a ";" or something, and it still has the link with "a" and no link with "t".

By "one letter change" do you mean switching from one theme to another?

With your browsers's "view source," you can look at the source code of the final page produced by the two theme versions, and you can then tell what is present and what is missing around the link/nolink. So maybe there are some clues here about what is different in the two themes.

Using the Firebug add-on in the Firefox browser is an easy way to see the divs, etc., used in your page from the "front side", if you don't want to dive into the end-result source code itself.

Anyway, in the Tikipedia theme, the calendar date link is in the div id="tiki_top_bar" in the template, but doesn't have any particular properties specified by CSS. In fact the div class is commented out in the css file. The link itself doesn't have a specific class so it inherits the general style for the page.

If you want to give it its own color, etc., you can uncomment #tiki_top_bar in your css file and specify properties for

#tiki-top_bar a
, etc. with the usual CSS syntax.


Of course this is the situation for the Tikipedia theme. If your modified version changes these details you'll have to adjust the solution here accordingly.

> What am I missing please? I guess I can just make a separate calendar link, but I thought it was an elegant way to do it. And I'm just befuddled and keen to learn what it is that I don't understand in this case (my ignorance is, admittedly, vast!)

Well, I'd say the key is to be sure how your template file identifies the link; that is, what div the link is located within in the .tpl file, and then be sure the css file reflects that information correctly.

-- Gary - themes.tw.oQuestion


I'm not 100% sure exactly what you're trying to do (maybe you have a URL that you can share that demonstrates what you're trying to do?), but one thing... the a in the style sheet refers to an <a ... > tag (such as <a href> — not a specific style, per se.

If the link that you're trying to change looks like this:

Copy to clipboard
&lt;a href class="foo">link... &lt;/a>


In your CSS, you should be looking for

.foo

and/or

a.foo

If you're unfamiliar with CSS you may want to to review http://www.w3.org/Style/CSS/learningQuestion for details.

HTH,

-RickQuestion
Coming soon: TikiWiki for Dummies Smarties — A beginner's guide to using ))TikiWiki((.

I really appreciate the helpful responses, and I'll try looking at the HTML as you suggest.

The site, in its current muddled form, is at www.sphericalcows.netQuestion so you can see what the output at present looks like.

Here are the details (sorry about the loss of formatting spaces, the 'monospace' wiki syntax doesn't seem to work here.) The beginning of the CSS file seems to define a default style "a":
a {
text-decoration: none;
color: #636385;
background: none; /* #fff7d1; unvisited links blue*/
}
a:visited {
color: #53984C;
background: none; /*visited links green*/
}
a:hover {
text-decoration: underline;
background: none; /* unknown */
}
The "color" markers are mine, part of trying to recreate as much as possible the look&feel of the site this is replacing.

It is fine, and all works. But a few things with this default style in the top menu are made unreadable given the background colour because of my change. These items are described in the tiki-top_menu.tpl file as:
{if $feature_calendar eq 'y' and $tiki_p_view_calendar eq 'y'}
{$smarty.now|tiki_short_datetime}
{else}
{$smarty.now|tiki_short_datetime}
{/if}

This looked like a use of the style, so I tried creating a new style in the CSS, exactly like (cut & paste) but changing the background colours. I then changed the reference to in this section of the .tpl file to . The colour now is fine, but the href to the calendar isn't there. I thought maybe I didn't understand and was connected to or invalid in some other way so I tried a one letter name with no different effect.

It is a small thing, and I won't suffer if I can't make it do what I expect (unlike some usability issues I'm hitting). But I would like to understand.

Thanks again!
Philip

errata: it is the tiki-top_bar.tpl file, not top_menu. My bad.😡

The tags around the date must remain "a" . . . "/a", as this is standard HTML to create a link. I took a look at the source code from the URL you gave, and noticed the substituted "t"'s. These must be changed back.

The question is how to change the color of the link (anchor tag), which wants to follow the global CSS specs for links on your site. As I described in my earlier post, you need to add a new CSS selector to apply to this link. Since it's in the tiki-top_bar div, you can apply CSS styling to it by this description;

#tiki-top_bar a

which is the parent div and child anchor, so the full phrase means the CSS style properties will apply to every anchor within the tiki-top_bar div. Follow CSS syntax to specify the style you want. w3schoolsQuestion is a good reference where you can even edit examples online.

-- Gary

Thanks to all for your assistance!

I was mistakenly reading the ... as a style rather than a more specific sort of HTML tag, which shows my ignorance. I appreciate your helpfulness and patience in explaining.

I now have something at least sort of workable by using a separate style tag within the ..., and am content until I gradually acquire a better understanding and can go back and refine things.

I console myself that it is by messing about (and by kind suggestions on forums) that I will gain that better understanding!

Regards,
Philip