Default Green Orange
grzegorz brzezinka.eu
Be curious. Laugh a lot.
    Home Page Home
  • Contact
RSS

Posts Tagged ‘webmastering’

How to have plugins rendered (processed) when generating PDF from Joomla article content?

Joomla 0 Comment »

Recently, I’ve been working on Joomla CMS based project, where I’ve added some additional features to the content (AJAX added content from database) using Jumi plugin.

In standard Joomla installation, by clicking PDF icon in top right corner of the article, you can generate a PDF version of your content. However, plugins are not processed: instead you will see plugin tags, ie. {jumi [test.php}. How to get it processed?

Solution (for Joomla 1.5)

I have found the solution on phpGTK2 CookBook. Quickly summarizing:

  1. Edit view.pdf.php localized in <joomla root>/components/com_content/views/articles.
  2. Around line 72 (just before $document = &JFactory::getDocument();), add two lines that triger plugin processing:
  3. JPluginHelper::importPlugin('content');
    $results = $dispatcher->trigger('onPrepareContent', array (& $article, & $params, 0));
    

    So the whole code in the neighbourhood of line 72 should look like this:

    // process the new plugins
    JPluginHelper::importPlugin('content', 'image');
    $dispatcher->trigger('onPrepareContent', array (& $article, & $params, 0));
    
    JPluginHelper::importPlugin('content');
    $results = $dispatcher->trigger('onPrepareContent', array (& $article, & $params, 0));
    
    $document = &JFactory::getDocument();
    
    // set document information
    $document->setTitle($article->title);
    $document->setName($article->alias);
    $document->setDescription($article->metadesc);
    $document->setMetaData('keywords', $article->metakey);
    

This is it! Now after clicking PDF icon, all your plugins should be processed in the output document. However, not all CSS is processed… but this is another story ;)


Marzec 17th, 2010  
Tags: Joomla, tips&tricks, webmastering



Joomla FishEye menu (Camp26) with jQuery in no conflict mode

Joomla 18 Comments »

Recently I had to implement a fish menu on a client website based on Joomla CMS. As the deadline was short, I decided to look for a script or module.

Open Source Script (javascript)

First I came across Fisheye Menu by Marc Grabanski. This is an open source script, maybe the mouseover effect is not compelling and extremely spectacular, but it does it job good and, what is really important, is quite easy to implement. You’ll find a firendly tutorial written by John Kolbert.

Fisheye menu script

Fisheye menu script (click to view it in action!)

Joomla module

Looking through Joomla Extension directory I have found non-commerial FishEye Menu from Camp26 team. It looks  much more similar to Mac-like Dock bar than the Grabanski’s script. It is based on jQuery and interface element script. The module is Joomla 1.5 native.

FishEye Menu Module by Camp26

FishEye Menu Module by Camp26

jQuery in non-conflict mode

The only problem is… the Camp26 module needs jQuery working in a normal mode, ie. using $(…) syntax:

$(document).ready(function() {
     ...
});

Joomla 1.5 has MooTools included as default javascript framework. Adding to this some components using Prototype, it is highly recommended to use jQuery in a non-conflict mode, ie. using jQuery(…) instead of $(…) syntax:

jQuery.noConflict();
jQuery(document).ready(function(){
       ...
});

The jQuery javascript framework may be easily included to your Joomla CMS in the non conflict mode with SC jQuery plugin.

Make FishEye Menu module work in non conflict mode

Normally, adopting a script to work with jQuery in non conflict mode is quite easy: just find&replace all $(… with jQuery(… . However, in case of that module it is not that easy. It was encrypted by Code26 team in order to protect from editing. Instead of regular javascript code you will find something like:

eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?'':e(parseInt(c/a)))+(...)

Fortunately, it is not a dead end. The solution is to put the encrypted content inside:

jQuery(document).ready(function($) {
    $('sth').removeClass();
});

As you can see, inside this structure a regular $(…) syntax may be used.

So finally, we have to edit:

  • fisheye.js and iutil.js modifying it as written above:
    (...)
    jQuery(document).ready(function($) {
        eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?'':e(parseInt(c/a)))+(...)
    });
    
  • default.php by simply replacing $(…) with jQuery(…) (in two places in code).

That’s it – now the module is properly working with jQuery in non conflict mode.

Here you can download a modified module.


Marzec 9th, 2010  
Tags: Joomla, tips&tricks, webmastering



Redirect page through .htaccess

webmaster tips 0 Comment »

Some time ago I have changed my hosting provider. I’ve turned to http://www.site5.com as my old provider http://www.nazwa.pl lacked of several useful options.

As a consequence, I had to move several websites to a new server… You know, a nightmare changing configuration files in different CMSes…

I have faced the following problem: some of the websites were stored in subfolders (subdomains), let’s say /blog (http://www.mydomain.com/blog). After the change, we want to have the website available under the main domain http://www.mydomain.com. How to do it?

Well, the answer seems to be quite simple: copy all files to your main directory and… sadly some elements are not working. Why? It turned out that some elements references still targeted to elements in /blog. There are two solutions:

  1. Manually change the path of each element (ex. using find&replace). But if you have thousends of files + entries in database… This may drive you crazy after a while, you can imagine. Far  better solution is:
  2. Create/modify the .htaccess file in the /blog directory:
    Redirect /blog http://www.mydomain.com

That’s it :-) The latter applies also if you want to redirect a subdomain to another web address.


Marzec 7th, 2010  
Tags: .htaccess, domain, hosting, tips&tricks, webmastering



  • Newest posts

    • Export to Excel (xls) in Rails3
    • Linux: how to renew DHCP IP address?
    • Full page background image in Prawn PDF in Rails3
    • Github error – fatal: Unable to look up github.com (port 9418) (Name or service not known)
    • RubyGems warning/error: Gem::Specification# default_executable = is deprecated with no replacement. It will be removed on or after 2011-10-01.
  • Tags

    human body eye hosting domain movie image google brain gym Math .htaccess wordpress science riddle Joomla webmastering fun Rails3 jQuery Ruby on Rails tips&tricks
  • In the blog you’ll find:

    • Funny (3)
      • Riddles (2)
    • interesting facts (1)
    • linux (1)
    • Projects (1)
    • science (5)
      • computer (1)
      • human body (1)
      • Math (1)
      • physics (1)
    • Uncategorized (2)
    • webmaster tips (23)
      • Joomla (2)
      • jQuery (6)
      • Rails3 (5)
      • Ruby (11)
      • WordPress (1)
  • Translate!

      Translate to:

      Powered by Google Translate.
Copyright © 2012 grzegorz brzezinka.eu All Rights Reserved
XHTML CSS Zaloguj się
Designed by iSoftware Reviews and