2013-02-24, 17:11:31
(This post was last modified: 2013-02-28, 20:32:34 by WebDevandPhoto.)
Okay, to combat the numerous relative link issues and at the same time allow immense customization, I put my CSS in php files and included them in my template... but this increases (obviously) the loading time per pay by 140KBs (size of both CSS files collectively).
So.. what would be the best way to have my plugin instead output CSS files from these php files on command? This way styles are used as they are supposed to (in external files that apply to every page) but the customization from the admin cp is possible as well as fixing any relative link issue with the use of
to make absolute urls.
.... re-reading that... it sounds confusing... what I'm trying to say is I want to built static CSS files from PHP data after variables are set via my plugin options... whats the best way to do this?
And question 2....
I'm trying to figure out how to allow a user to paste their social site links in a text box and parse each line and validate the url. Then parse each line (I'll add html to give it an image whos filename matches the domain) in my template header....
Make sense? This way the user can just paste away and go instead of tediously trying to find the each field which matches their social site (and theme options would get really messy with 100s of fields).
So... any ideas?
Help is much appreciated!
This is all towards working on a major update to my FoundationNation theme for GetSimple.
Edit:
Doing things this way hasn't worked yet:
And I don't want to change .htaccess to use css files as php.
I just want the php page to output the css file when accessed.
trying some function ideas out to see if I can make this method to work:
http://aquagraphite.com/2011/11/dynamically-generate-static-css-files-using-php/
I was thinking something like this:
is there a better way?
So.. what would be the best way to have my plugin instead output CSS files from these php files on command? This way styles are used as they are supposed to (in external files that apply to every page) but the customization from the admin cp is possible as well as fixing any relative link issue with the use of
PHP Code:
<?php get_theme_url(); ?>
.... re-reading that... it sounds confusing... what I'm trying to say is I want to built static CSS files from PHP data after variables are set via my plugin options... whats the best way to do this?
And question 2....
I'm trying to figure out how to allow a user to paste their social site links in a text box and parse each line and validate the url. Then parse each line (I'll add html to give it an image whos filename matches the domain) in my template header....
Make sense? This way the user can just paste away and go instead of tediously trying to find the each field which matches their social site (and theme options would get really messy with 100s of fields).
So... any ideas?
Help is much appreciated!
This is all towards working on a major update to my FoundationNation theme for GetSimple.
Edit:
Doing things this way hasn't worked yet:
Code:
<link rel='stylesheet' type='text/css' href='css/style.php' />
I just want the php page to output the css file when accessed.
trying some function ideas out to see if I can make this method to work:
http://aquagraphite.com/2011/11/dynamically-generate-static-css-files-using-php/
I was thinking something like this:
PHP Code:
/* This generates our PHP powered CSS files on demand */
function generate_styles_css() {
global $SITEURL;
global $TEMPLATE;
$themeurl = trim($SITEURL . "theme/" . $TEMPLATE);
$stylefile_style = $themeurl . '/style.php';
$stylefile_app = $themeurl . '/appstyle.php';
if(file_exists($stylefile_style && $stylefile_app)){
ob_start(); // Capture all output
require($stylefile_style); // Generate CSS for style.php
require($stylefile_app); // Generate CSS for appstyle.php
$stylescss = ob_get_clean(); // Get generated CSS (output buffering)
file_put_contents($themeurl . 'style.css', $stylescss, LOCK_EX); // Save it
}
}