Comments (6)
lol...just doesn't work: Parse error: syntax error, unexpected T_IF in /home/exodch/public_html/bern-derfilm/assets/site/booster/booster_inc.php on line 1798
how do I make an if statement in a for loop?
Edit: ok, I have it...but it looks ugly =)...could this be done better?
for($j=0;$j<intval($this->css_totalparts);$j++)
{
$linkcode .= '<link rel="'.$this->css_rel;
$linkcode .= '" media="'.$this->css_media;
if ( $this->css_title != '' ) {
$linkcode .= '" title="'.htmlentities($this->css_title,ENT_QUOTES);
} else { }
$linkcode .= '" type="text/css" href="'.$this->base_offset.ltrim($booster_path,'/').'/booster_css.php';
$linkcode .= ($this->mod_rewrite ? '/' : '?');
$linkcode .= 'dir='.htmlentities(str_replace('..','%3E',$source),ENT_QUOTES);
$linkcode .= '&cachedir='.htmlentities(str_replace('..','%3E',$this->booster_cachedir),ENT_QUOTES);
$linkcode .= ($this->css_hosted_minifier ? '&css_hosted_minifier=1' : '');
$linkcode .= '&totalparts='.intval($this->css_totalparts);
$linkcode .= '&part='.($j+1);
$linkcode .= ($this->debug ? '&debug=1' : '');
$linkcode .= ($this->librarydebug ? '&librarydebug=1' : '');
$linkcode .= (!$this->js_minify ? '&js_minify=0' : '');
$linkcode .= '&nocache='.$this->filestime.'" ';
$linkcode .= ($this->markuptype == 'XHTML' ? '/' : '').'>'."\r\n";
}
from css-js-booster.
Will be in the next release.
from css-js-booster.
BTW: Why don't you get your code from Booster's public function $booster->css_markup()? It would return all of the above and you had an easier life slapping in updates of the Booster into your MODx-plugin.
from css-js-booster.
Done
from css-js-booster.
Nice, thanks for the update, just implemented it and it works as expected =) both of the fixes! I knew there was a more elegant way to do what I tried above =P...I'm still a php n00b, just learning stuff every day...could you explain what you did here:
($this->css_title != '' ? ' title="'.htmlentities($this->css_title,ENT_QUOTES).'"' : '').
what is the "?" and where in the phpdocs can I read about this (btw. how is this called)?
thanks anyways, modx snippet working already, just have some trouble with booleans...
from css-js-booster.
Sure! The construction above is a shorthand-version of the if/else-logic. The complete logic needs to be set into parenthesis (), then first comes the condition to test for. Then comes a ? as a separator, followed by the value for the condition being TRUE. Then again there is a separator, the :, and last you have the value for the condition being FALSE.
You can find some examples here:
http://davidwalsh.name/javascript-shorthand-if-else-examples
I think in some cases (not all), especially when you have lots and lots of if/else-stuff concentrated in one point, or when you need to assign if/else-driven values to variables (see the top of booster_css.php for example), it helps keeping an overview and the code a little more compact and readable.
Tell me when your MODx-plugin is ready! Then I will include a link to it.
from css-js-booster.
Related Issues (20)
- CDN will cache the "temporary file"
- Wrong datauri path generation in css_datauri_cleanup() ? HOT 1
- Cannot get any CSS files to work in a MCV setup
- Can't deactivate the plugin HOT 8
- Better handling of files not found
- Insert safety-semicolons between concatenated JS-files
- Ensure that when js_minify = false it *is* not minified
- Remove @charset declarations when they occur in CSS
- image url in css HOT 1
- Compress once and then serve those .gz files
- Webfonts included via Data URI donβt work in Internet Explorer HOT 1
- GZIP & Cache Fonts
- Problem with empty CSS media-Attribute
- Fallback when no connection to the web
- Additional "productivity" mode w/ no timestamp
- .htaccess routing to static cached versions if existing
- Can't deactivate plugin without loosing CSS HOT 4
- Set default timezone as required by PHP5.2+
- htaccess leads to Internal Server Error HOT 1
- Does this library work with NGINX server? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from css-js-booster.