Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 09:07:03 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155527 Posts in 21712 Topics by 7737 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: 2.8RC1 - Snippets und frontend.css/.js  (Read 919 times)
DarkViper
Development Team
*****
Offline Offline

Posts: 1252


« on: August 03, 2009, 02:43:26 PM »

Nachdem ich mich gründlich geärgert hatte, dass z.B. im Snippet 'anynews' Änderungen der mitgelieferten frontend.css wirkungslos blieben, knöpfte ich mir den Core vor und stellte fest, dass diese Dateien überhaupt nicht eingelesen werden.
Folgende Änderung an der /framework/frontend.functions.php beheben dieses Manko:

Code:
360     // define constant indicating that the register_frontent_files was invoked
361     if($file_id == 'css') {
362         if(!defined('MOD_FRONTEND_CSS_REGISTERED')) define('MOD_FRONTEND_CSS_REGISTERED', true);
363     } else {
364         if(!defined('MOD_FRONTEND_JAVASCRIPT_REGISTERED')) Define('MOD_FRONTEND_JAVASCRIPT_REGISTERED', true);
365     }
366     // ensure that frontend.js or frontend.css is only added once per module type
367     if(strpos($head_links, $tmp_link) === false) {
368         $head_links .= $tmp_link ."\n";
369     }
370 };
371 }
372 // Function to add optional snippet Javascript or CSS stylesheets into the <head> section of the frontend
373 // modification by ISTeam, Werner von der Decken  2009
374 // BEGINN mod --------------------------------------------
375 $query_modules = $database->query("SELECT directory AS module FROM " .TABLE_PREFIX ."addons    WHERE function = 'snippet'");
376
377 while($row = $query_modules->fetchRow()) {
378 // check if snippet module directory contains a frontend.js or frontend.css file
379     if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file")) {
380 // create link with frontend.js or frontend.css source for the current module
381         $tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
382
383 // define constant indicating that the register_frontent_files was invoked
384         if($file_id == 'css') {
385             if(!defined('MOD_FRONTEND_CSS_REGISTERED')) define('MOD_FRONTEND_CSS_REGISTERED', true);
386         } else {
387             if(!defined('MOD_FRONTEND_JAVASCRIPT_REGISTERED')) define('MOD_FRONTEND_JAVASCRIPT_REGISTERED', true);
388         }
389 // ensure that frontend.js or frontend.css is only added once per module type
390         if(strpos($head_links, $tmp_link) === false) {
391             $head_links .= $tmp_link ."\n";
392         }
393     };
394 }
395 // END mod -----------------------------------------------
396 // include the Javascript email protection function
397 if( $file_id != 'css' && file_exists(WB_PATH .'/modules/droplets/js/mdcr.js')) {

Logged

Anleitungen lesen und selber nachdenken ist anstrengend...  Da lass ich doch lieber andere für mich denken...

In 1984:  Nineteen Eighty-Four is a unrealistic utopia!!
In 2012:  Nineteen Eighty-Four is a little piece only of our reality!!
Luisehahne
Board Member
Development Team
*****
Online Online

Posts: 3146



WWW
« Reply #1 on: August 03, 2009, 02:53:27 PM »

War mir auch schon aufgefallen. Bin da aber etwas andere Wege gegangen. Es fehlt bei dir noch die frontend_body.js. Ich setze nur die Link-Variablen und überlasse  die Verarbeitung der Funktion selber. Ist zur Zeit im Test, kann aber nicht abschliessend sagen, ob es mit in die Final reinkommt. Sinnvoll wäre es, freue mich, dass ich nicht alleine mit meiner Meinung da stehe. Ist ja auch die Überlegung wegen Geschwindigkeitsver lusten, wenn mehr als 1 User Online ist und auf die Seiten zugreift.

Dietmar

Logged

We are human beings - and nobody is perfect at all.
doc
Guest
« Reply #2 on: August 03, 2009, 05:19:16 PM »

@DarkViper:
Thanks for picking this up again. Have created a ticket for this.

Doc
Logged
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« Reply #3 on: August 06, 2009, 06:50:13 PM »

Hello,

added the code from luisehahne to WB 2.8. It is now possible to use frontend.js, frontend_body.js and frontend.css also from snipets.

http://project.websitebaker2.org/changeset/1107

Matthias
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!