Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-07-26 02:37:42

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Better CSS

I’m not really sure why CSS in Textpattern relies on the separate css.php file that is included in the core files, but even more so that it is called actually on the page where your css is, eg. /textpattern/css.php?n=mystylesheet

What I think would really make things better is if natively Textpattern had all CSS files stored in the database like they are now AND also saved to a directory like rvm_css, and then have them called them in this manner /?css=mystylesheet if being called from the DB and /css/mystylesheet.css if called directly from the static version on the server. Perhaps even have an option in preferences to turn on the static files if certain users dislike it?

In addition to this, native support for JavaScript files could also be a good one, or perhaps the ability to incorporate JS files using a plugin based on the same concepts brought forth for the CSS.

This is something that has being bothering me for a while, and would love to see implemented, as it would be much cleaner. Your thoughts?


~ Cameron

Offline

#2 2009-07-26 03:25:37

TheEric
Plugin Author
From: Wyoming
Registered: 2004-09-17
Posts: 566

Re: Better CSS

There’s lots of stuff that bothers you about TXP evidently.

Offline

#3 2009-07-26 04:33:21

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Better CSS

theming is coming up Cameron


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2009-07-26 08:51:31

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: Better CSS

Saving to both the database and a file introduces a level of redundancy and may also introduce confusion because they are in two places (where to edit, via ftp, via interface…, make sure synced). But essentially you can make the decision yourself based on how you want it (I’m often adapting the setup to fit the needs of the respective site and users):

  • Use files and put them in a /css/ directory and call them directly.
  • Use rvm_css, which was conceived for just this purpose.
  • Add an entry to your htaccess to make links formed as /css/ call /textpattern/css.php?n=mystylesheet.

Last edited by jakob (2009-07-26 08:51:53)


TXP Builders – finely-crafted code, design and txp

Online

#5 2009-07-26 11:04:36

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Better CSS

driz wrote:

What I think would really make things better is if natively Textpattern [..] have them called them in this manner /?css=mystylesheet

Care to explain in what regard this particular way of constructing the CSS’s URI would be beneficial?

Offline

#6 2009-07-26 13:33:06

keith
Member
From: Blyth, Northumberland, England
Registered: 2004-12-08
Posts: 199
Website

Re: Better CSS

I was wondering the same thing: that’s “better” about this implementation?

Kinda seems like change for change’s sake to me.


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#7 2009-07-26 13:43:40

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

Re: Better CSS

I’m guessing consistency, because apart from static things like images, everything else is using index.php. The reason for having the separate css.php may have been efficiency. Why load a huge chunk of code, when only a small bit is needed for serving CSS.

Offline

#8 2009-07-26 18:32:48

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Better CSS

Well consistency is one factor for having better URLS. Second linking to a file inside the textpattern folder exposes it and makes it awkward if you want to change the name of the installation.


~ Cameron

Offline

#9 2009-07-26 18:37:48

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

Re: Better CSS

SVN currently has css.php outside the textpattern folder, alongside index.php.

Offline

#10 2009-07-26 18:42:14

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Better CSS

ruud wrote:

SVN currently has css.php outside the textpattern folder, alongside index.php.

What is the purpose of having the CSS.php file at all? Why isn’t it part of the actual core files? Their are two CSS.php files as well one outside TXP and then one inside TXP which link to each other.

wet wrote:

Care to explain in what regard this particular way of constructing the CSS’s URI would be beneficial?

Just cleaner and fits in better with the URL schemes produced by Plugins. Its better IMO to be just simply dynamic using the ? rather requiring the linkage to the actual php file(s) used for the creation of the CSS. ExpressionEngine uses this very same idea for the exact same reasons.

Last edited by driz (2009-07-26 20:02:18)


~ Cameron

Offline

#11 2009-07-26 20:08:38

artagesw
Member
From: Seattle, WA
Registered: 2007-04-29
Posts: 227
Website

Re: Better CSS

css.php was moved outside the textpattern folder to enable the multi-site capabilities in 4.2. The css.php inside the textpattern folder is for backward compatibility, I believe.

Offline

#12 2009-07-26 20:32:30

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Better CSS

My confusion here is that CSS to rendered using <txp:css n="lorem" /> so if someone was to move the CSS.php file, their would be no need to worry about backwards compat because the linkage is left in the hands of TXP and NOT the user creating the link themselves right?

But I still dont understand why their is a separate file for PHP? Why is the code for it not included with the rest of code for images/links/files/pages/sections etc.


~ Cameron

Offline

Board footer

Powered by FluxBB