Daniele Procida wrote:
> In a template I have:
> 
>     {% placeholder right-column Textarea %}
> 
> I'd like the template to load stylesheetb.css rather than
> stylesheeta.css if that content item is empty.
> 
> I guess I need some logic around the the styles listed in the <head>,
> but I don't know what it should be, so I'd be grateful for any suggestions.

In one of our sites, we have a base.html template. In it, we have:

{% block base_css %}
<link rel="stylesheet" type="text/css" href="/site_media/css/base.css">
<link rel="stylesheet" type="text/css" href="/site_media/css/navbar.css">
<link rel="stylesheet" type="text/css" href="/site_media/css/help.css">
{% endblock %}
{% block extrahead %}{% endblock %}

The home page of the site has different styling than the interior pages.
In the index.html template, we have:

{% extends "base.html" %}
{% block base_css %}{% endblock %}
{% block extrahead %}
<link rel="stylesheet" type="text/css" href="/site_media/css/index.css">
{% endblock %}

In your case, you could have something like the following on that
specific page template, or if you need it for the general case, in your
base page template.

{% block base_css %}
{% if content %}
    <link rel="stylesheet" type="text/css"
href="/site_media/css/stylesheeta.css">
{% else %}
    <link rel="stylesheet" type="text/css"
href="/site_media/css/stylesheetb.css">
{% endif %}
{% endblock %}
-- 
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6

<http://dinamis.com>
+1 416-410-3326

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to