developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 12 years ago

#531 closed bug (wontfix)

Template meta CSS aren't generated in the right order

Reported by: SooW Owned by:
Priority: normal Milestone: jelix 1.1
Component: jelix:tpl Version: 1.0.2
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

Here's an example:

I've a framework template, which includes another template for the current page. If the framework template includes a CSS stylesheet with "{meta_html css $j_themepath.'css/framework.css'}", I want to be able to include another CSS in the current page. This would allow me to define the style of "div#content" in the framework, and to override in the other CSS.

This means that I want Jelix to output the <link> nodes in their order of appearance. Currently, Jelix seems to do just as it wants, and this bothers me.

As I'm French, you can comment on this report in French if you prefer.

Change History (7)

comment:1 Changed 12 years ago by laurentj

  • Resolution set to wontfix
  • Status changed from new to closed

It is too difficult to fix it. CSS link order is the order of template fetching.

If you want some CSS links appearing before any other, you should declare them in the constructor of your own response object.

comment:2 Changed 12 years ago by laurentj

  • Priority changed from high to normal
  • Resolution wontfix deleted
  • Severity changed from major to normal
  • Status changed from closed to reopened

A solution could be a different implementation of jResponseHtml::addCSSLink, which would allow us to add the css link at the top or at the bottom of the list of css link.

comment:3 Changed 12 years ago by SooW

By default, it should just appear in the order of appearance. In my example, Jelix will first open framework.tpl then the other which is inside. When you find a CSS meta, you should just add it to the array. Then, generation of the HTML will output the CSS <link> in the right order, no ?

comment:4 Changed 12 years ago by laurentj

I've a framework template, which includes another template for the current page

How did you made this include ?

comment:5 Changed 12 years ago by SooW

Can't look at the file right now, but the framework template contains a zone that includes the other template.

framework.tpl:

{meta css framework.css} <div id="content">

{zone 'my_page'}

</div>

my_page.zone.php:

uses 'my_page.tpl'

my_page.tpl:

{meta css my_page.css} <h1>My page</h1>

Where both CSS files qualify HTML element div#content. I want my_page.css to be able to override framework.css. Currently, it works by using !important on CSS attributes. But as you said, it should work by declaring the links in the constructor of my response object.

comment:6 Changed 12 years ago by laurentj

  • Milestone set to jelix 1.1

comment:7 Changed 12 years ago by laurentj

  • Resolution set to wontfix
  • Status changed from reopened to closed

Since we cannot add an element at the begining of an associative array in PHP, changing the addCSSStyle method will add some cost on performance.

Note: See TracTickets for help on using tickets.