Home » Forum
NoNumber!

Joomla!® Websites & Extensions
development  -  support  -  consultancy

I try to respond within 48 hours (excluding weekends).
If I haven't responded by then, feel free to post a reminder or bug me via email.

My last reply was: 2 Hours, 53 Minutes ago.

Welcome, Guest
Please Login or Register.    Lost Password?

Newbie question: inserting a CSS snippet
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Newbie question: inserting a CSS snippet
#7734
Newbie question: inserting a CSS snippet 1 Year, 11 Months ago  
Hi

I am editing an article with the JCE editor. Within the article I would like to markup a snippet of .CSS .

.ms-titleimagearea {
display: none;
}


Do I simply surround this with the {source){/source} tags or as I suspect I need to do more to make this standout in my article



cheers

Daniel
The administrator has disabled public write access.
 
#7735
Re: Newbie question: inserting a CSS snippet 1 Year, 11 Months ago  
See the sticky topics:
www.nonumber.nl/forum/14-sourcerer
Peter van Westen
Admin
Posts: 9169
User Online NowClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#7738
Re: Newbie question: inserting a CSS snippet 1 Year, 11 Months ago  
Thank you for that hint. Well I did follow the example with a simple .css class

<?php
    // testing out syntax highlighting
    $css = '.ms-titleimagearea { display: block; }' ;
    $doc =& JFactory::getDocument();
    $doc-> addStyleDeclaration( $css);
    
?>
{/source}



However, I get nothing displayed when I publish my article. I have tried the '[[' & ']] ' delimiters as well.

Daniel
The administrator has disabled public write access.
 
#7740
Re: Newbie question: inserting a CSS snippet 1 Year, 11 Months ago  
That should put the style into the head of your page.
I do see a space in $doc-> addStyleDeclaration. That should be $doc->addStyleDeclaration

Also, don't forget the opening {source} tag.

Do you have a link to the page you are trying this on?
Peter van Westen
Admin
Posts: 9169
User Online NowClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#7742
Re: Newbie question: inserting a CSS snippet 1 Year, 11 Months ago  
Thanks for your peristance.

I removed the space and noted that the opening {source} tag missing from cut and paste was correctly in place in the actual article.

I have cut out the section which contains the .CSS snippet into a 'dummy' article.

www.westerdale.biz/component/k2/item/22-syntax-test


I have indicated where I have placed the Source markup in italics.
CSS Snippet to go here

{source}
<!-- Here is my css snippet -->
<?php
    // testing out syntax highlighting
    $css = '.ms-titleimagearea { display: block; }' ;
    $doc =& JFactory::getDocument();
    $doc->addStyleDeclaration( $css);
    
?>
{/source}



The article is published in a standard K2 module.





Daniel
The administrator has disabled public write access.
 
#7744
Re: Newbie question: inserting a CSS snippet 1 Year, 11 Months ago  
In the head of your websites output I see:
  <style type="text/css">
    <!--
.ms-titleimagearea { display: block; }
    -->
  </style>

So Sourcerer is working fine.

But you have a serious problem in the output. Probably something weird in your template file.

You have 2 sets of <html> tags in the output. So also 2 <head>s and 2 <body>s!!!
Just have a look at your html source output.
Peter van Westen
Admin
Posts: 9169
User Online NowClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#7746
Re: Newbie question: inserting a CSS snippet 1 Year, 11 Months ago  
I now see what you arwe trying to do.
You want the css snippet to actually be displayed in the article!?

This is not really what Sourcerer is for. Sourcerer is meant to actually handle the code. Not display it.
Peter van Westen
Admin
Posts: 9169
User Online NowClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#7753
Re: Newbie question: inserting a CSS snippet 1 Year, 11 Months ago  
Yikes.... I will get on a fix my dodgy html. I see what you mean about the CSS in the header.

Thanks

Daniel
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: Peter van Westen
MaxCDN | Content Delivery Network | Accelerate your site to the max
hosting joomla
Open Source Training | Online Joomla! Training and Support