Print page
Blazing Images Web Site Design, Inc.
Main Menu
  • Home
  • About Us
  • Our Services
    • Web Design
    • Dynamic Development
    • Hosting
    • Promotion
  • Contact Us
Search

Our Blogs
  • WebAssist
  • Joomla!
  • Technical Support
  • jQuery & jQuery UI

Category: Joomla!

Using Sourcer with CKEditor for Joomla

© 2012-11-15 by Steven

I am using CKEdit

or for Joomla with Joomla! 2.5 (I know I need to update this site) and had a hard time getting sourcer to work. The problem was that CKEditor encoded everything including apostrophes.

If I turned off encoding, nothing would be encoded which is a problem for client admin input.

I used the lower 3 options before coming to this conclusion:

The Best Method for Using Sourcer:

Leave the HTML Entities radio button on Yes:

sourcer1

Add the following into the Custom Configuration:

sourcer_best

// The following MUST be double backslashed every change.
CKEDITOR.config.protectedSource.push( /{source}[\\s\\S]*?{\\/source}/g );

Here is the twist. Notice every backslash is double backslashed. Every time you save the configuration, it strips one backslash, SO ANY FUTURE CHANGES REQUIRE YOU TO REPEAT THE DOUBLE BACKSLASHING OR THE WYSIWYG editor will break.

(image after save)
sourcer_best_after_save

Below are three other options for entering source code into CKEditor for Joomla!:

The first option:

  • PRO
    • Easy to implement
    • Retains the encoding of basic HTML special chars for lay users and convenience
  • CON
    • Can't use OOP (No > char)
    • Can only use apostrophes. No Quotes inside code.

To do this leave the option for encoding entities on:

sourcer1

Then in the Custom Configuration space add this:

sourcer2
The default value of config.entities_additional is the encoded apostrophe, so this removes that value.

The Second Option:

  • PRO
    • Can use OOP
    • Can use Quotes and apostrophes
  • CON
    • No encoding takes place. Text entry does not encode ampersands, quotes, apostrophes, etc.
To do this, turn off the radio button for encoding, and add this to the box below to still encode ampersands and angle brackets. NOTE: The first line is probably not necessary as the radio button already did that, but I settled for option 1 and did not test that.

CKEDITOR.config.entities = false;
CKEDITOR.config.basicEntities = true;

sourcer3

The Third Option:

  • PRO
    • Best of both worlds. Encoding takes place on entered text, PHP is preserved (No [[ ]] syntax), you can use quotes and apostrophes, and you can use OOP
  • CON
    • Must be careful making any further adjustments to CKEditor properties
    • Potential security risk. If you screw up the CKEditor settings (see below), your PHP code may show up in the site. Also, if you are not careful, it could expose the public side to entering PHP code through a WYSIWYG editor (though I think the framework would prevent it unless the public side had access to sourcer as well).

To use the third method, turn encoding back on through the radio button and add the following to the Custom Configuration:

sourcer4Here is the twist. Notice every backslash is double backslashed. Every time you save the configuration, it strips one backslash, SO ANY FUTURE CHANGES REQUIRE YOU TO REPEAT THE DOUBLE BACKSLASHING OR THE WYSIWYG editor will break.

(Image after saving config)
sourcer5

This code protects PHP so you can have your cake and eat it to as long as you don't break the cake.

Comments 0 | Read more...

Display/hide a module by criteria other than menu item

© 2010-04-29 by Steven

We have used a number of modules which we want to display or hide by criteria other than the Joomla default control of attaching the module to specific menu items. For example, we use Jaggy Blog which provides a module for our blog categories. We want the blog tag words to appear when the blog is being viewed, but not on the rest of the site. Since the categories are delivered through the module, there is no menu item to attach the tag word module to.

Here is a way to accomplish this. First, you need some PHP criteria to identify the page you want to display or hide the module on. Next you need a couple of plugins. We are using mod_PHP and Modules Anywhere.

mod_PHP allows you to create modules that include code like Javascript and PHP code. Being able to include PHP code is essential. Modules Anywhere allows you to include modules in various place on your site including content areas and in this case, inside another module.

For the criteria, in our case, it was the GET value of view which equals Jaggyblog when we want the module to display. If you are using SEF links, you may need to hack you template to temporarily display GET values, or look at the link on a menu item or in you SEF listing if you are using a 3rd party extension. In our case we created a couple of menu items for the blog to find the parameter we needed.

Next create the module that you want to include and attach it to no menu items:

Create the module to be included.

Next you need to create the module that will include the module we just created. Notice that we called the previous module a name which ended in "Include." because it won't be displayed on its own, but rather wrapped in the module we are about to create. We create a mod_PHP module (notice because mod_PHP was based on mod_HTML, it still says modHTML in the module type) which we called the same name as the previous module without the "Include."

Create the modPHP module.

In the first module, the position and order don't matter because it is not assigned to any menu items. This module (mod_PHP) needs to be assigned to all menu items. That tells Joomla it should always be displayed. Here is the trick. If the module contents is empty, it won't display. In our cases so far, the title bar does not display when using this technique, so if you use a module included this way and it shows up on every page as an empty module with a title bar, please let us know so we can take a look at it.

Now in the contents of the module use the PHP criteria you devised to display the contents only if your criteria is met. In our case, it was if ($_GET['view']=="jaggyblog") {

Set the cirteria using PHP

And there you go. The module only displays when the view is of the type we want. The div tag with the id of blogTags is optional. We included that so we could get the title element back. Next time we'll describe how this was done.

Tags: PHP, MySQL, Joomla!, Javascript, jQuery, CMS, Content Management Systems
Comments 0 | Read more...

Hide your website name in Joomla

© 2010-04-29 by Steven

Hide your website name!
Why would you want to do that?

If you look at our site home page, you can see that the website name is displayed at the top of the article, but that is, in fact, the article title. When the website title is displayed, it shows up as a separate content bubble and this is not what we wanted. In short, you may want to do this because the title is in your banner, or you want to display the title in a different way in using the first article displayed on your home page.

So you tried hiding the title of the article you are using for your home page, but that just hides the title you want, or you tried hiding everything you could think of and even looked for parameters in the Front Page Manager. Nothing worked.

Here is how you do it. You should have a home page link on your menu. It is not just an article menu item, it is a special menu type called Front Page Blog Layout:

img001

So you need to edit the menu item. Go to the System Parameters and click on No under Show Page Title:

img002

That's it. The title should be gone.

Tags: PHP, MySQL, Joomla!, CMS, Content Management Systems
Comments 3 | Read more...
Copyright © 1996-2023 Blazing Images Web Site Design, Inc. All rights reserved.