Page 1 of 1

Having a problem calling a specific stylesheet from within a template [SOLVED]

Posted: Thu Oct 07, 2010 1:41 pm
by luminous
What follows used to work fine, and has done for several months.  Following an upgrade from 1.8 to current version 1.8.2 I have not been able to load in specific non-attached stylesheets that have been called from within templates.

I've tried a fair few things, and on clean local installs, so this has to be down to how I am doing things.

The tag {cms_stylesheet} comes with an option to call a specific stylesheet that is not attached to your current template.  In my case, the stylesheet is within an IF statement.

I am using {cms_stylesheet name="jpmie7"}.  The stylesheet "jpmie7" has been added into the cms database list of stylesheets, but not attached to any specific template.

Even when I remove the IF statement from my template header, the stylesheet "jpmie7" is never actually loaded

quote from the help section of the {cms_stylesheet} tag
(optional)name - Instead of getting all stylesheets for the given page, it will only get one specifically named one, whether it's attached to the current template or not.



   
   
   
   

{if $page_alias != "home"}
   {sitename} - {title}
{else}
   {sitename} an Independent Garage providing:- MOT, Bodyshop, ECU Remapping, Tuning, Motorsport, Rallying services.
{/if}

{* Favourites Icon *}


{metadata}

{cms_stylesheet}


{cms_stylesheet name="abyteie7"}







This has been loaded into a base install of CMSMS 1.8.2 and still fails:
----------------------------------------------

Cms Version: 1.8.2

Installed Modules:

   * CMSMailer: 2.0
   * FileManager: 1.0.2
   * MenuManager: 1.6.5
   * ModuleManager: 1.4
   * News: 2.10.6
   * nuSOAP: 1.0.2
   * Printing: 1.1.0
   * Search: 1.6.5
   * ThemeManager: 1.1.1
   * TinyMCE: 2.7.2


Config Information:

   * php_memory_limit:
   * process_whole_template: false
   * output_compression: false
   * max_upload_size: 128000000
   * default_upload_permission: 664
   * url_rewriting: none
   * page_extension:
   * query_var: page
   * use_hierarchy: true
   * image_manipulation_prog: GD
   * auto_alias_content: true
   * locale:
   * default_encoding: utf-8
   * admin_encoding: utf-8
   * set_names: true


Php Information:

   * phpversion: 5.3.1
   * md5_function: On (True)
   * gd_version: 2
   * tempnam_function: On (True)
   * magic_quotes_runtime: Off (False)
   * E_STRICT: 0
   * E_DEPRECATED: 0
   * memory_limit: 128M
   * max_execution_time: 60
   * output_buffering: On
   * safe_mode: Off (False)
   * file_uploads: On (True)
   * post_max_size: 128M
   * upload_max_filesize: 128M
   * session_save_path: \xampp\tmp (0777)
   * session_use_cookies: On (True)
   * xml_function: On (True)


Server Information:

   * Server Api: apache2handler
   * Server Db Type: MySQL (mysql)
   * Server Db Version: 5.1.41


----------------------------------------------

Re: Having a problem calling a specific stylesheet from within a template

Posted: Thu Oct 07, 2010 3:35 pm
by Dr.CSS
I this is fixed in version 1.8.2, I just tested it...

Re: Having a problem calling a specific stylesheet from within a template

Posted: Thu Oct 07, 2010 3:38 pm
by luminous
Hmm, I'm never one to doubt you given your experience.  But for some reason its just not working for me :(  I'm definitely running 1.8.2, is there anything else that I can look for?

Re: Having a problem calling a specific stylesheet from within a template

Posted: Thu Oct 07, 2010 5:32 pm
by luminous
I don't understand how you have managed to get it to work.

I have just downloaded the full version of 1.8.2 from cmsms website, verified the hash values and added only one stylesheet to the default setup.  Added it using the method above in this case putting

{cms_stylesheet}
{cms_stylesheet name="test"}

Nothing from test is loading :( 

Its failing to load on either my xampp local server, or my remote host.  :'(

Re: Having a problem calling a specific stylesheet from within a template

Posted: Thu Oct 07, 2010 6:18 pm
by Peciura
For time being assign your CSS to dummy template and call {cms_stylesheet templateid='dummy_template_id'}.
You could also use ScriptDeploy - it is even better than {cms_stylesheet}.

Re: Having a problem calling a specific stylesheet from within a template

Posted: Thu Oct 07, 2010 6:21 pm
by luminous
Peciura wrote: For time being assign your CSS to dummy template and call {cms_stylesheet templateid='dummy_template_id'}.
You could also use ScriptDeploy - it is even better than {cms_stylesheet}.
Thanks :)  Never even thought of trying a dummy template.  Will give that a try.

Not yet used ScriptDeploy, will read up on that.   8)

8) I do love you guys ;)  8)

Re: Having a problem calling a specific stylesheet from within a template

Posted: Thu Oct 07, 2010 7:45 pm
by luminous
Dummy template plan seemed like a reasonable one, but its a no go.

Have tried the following in a totally clean install:
{process_pagedata}

{* Change lang="en" to the language of your site *}

{* note: anything inside these are smarty comments, they will not show up in the page source *}
 
{if isset($canonical)}{elseif isset($content_obj)}GetURL()}" />{/if}

{title} | {sitename}
{* The sitename is changed in Site Admin/Global settings. {title} is the name of each page *}

{metadata}
{* Don't remove this! Metadata is entered in Site Admin/Global settings. *}

{cms_stylesheet}

{cms_stylesheet templateid="dummyIE7"}

{* This is how all the stylesheets attached to this template are linked to *}

{cms_selflink dir="start" rellink=1}
{cms_selflink dir="prev" rellink=1}
{cms_selflink dir="next" rellink=1}
{* Relational links for interconnections between pages, good for accessibility and Search Engine Optmization *}




{* The above JavaScript is required for Menu - NCleanBlue-css to work in IE6 *}

{* the literal below and the /literal at the end are needed whenever there are {"curly brackets"} as smarty will think it's something to process and will throw an error *}
{* IE6 png fix *}
{literal}



// argument is a CSS selector
DD_belatedPNG.fix('.sbar-top,.sbar-bottom,.main-top,.main-bottom,#version');


/* enable background image caching in IE6 */
html {filter:expression(document.execCommand("BackgroundImageCache", false, true));}


{/literal}

 
The style "test" was attached to "dummyIE7".  Several styles were deleted from the default style sheet and copied into test.  They never loaded :(

Will run with script deploy.  Seems like a worthy upgrade anyway.  Would be nice for {cms_stylesheet} to work again soon though.

Re: Having a problem calling a specific stylesheet from within a template

Posted: Thu Oct 07, 2010 8:18 pm
by Peciura
Template id is a number like
{cms_stylesheet  templateid='22'}
move mouse over template name, it is the vale of parameter 'template_id'
/admin/edittemplate.php?sp_=5a0dc0b0&template_id=22

Re: Having a problem calling a specific stylesheet from within a template

Posted: Thu Oct 07, 2010 8:40 pm
by luminous
Thanks.  will take a look at it tomorrow.  Been at this since about 8am, too close to it now, making silly errors.  (not to mention I just nuked my local experiment as a "bad idea" lol)

EDIT: Curiosity got the better of me, got things setup and did a quick test, it works.  Thanks so much for both ideas  :)