sourcerer and joomla! rev. 20130903

Download Sourcerer and Joomla! rev. 20130903

If you can't read please download the document

Upload: douglaspickett

Post on 25-May-2015

2.224 views

Category:

Technology


1 download

DESCRIPTION

Presented at the Joomla! User Group Toronto meeting of August 20, 2013. Covers setting up an environment under Linux, using Bluefish to create PHP code that can be executed using the Sourcerer extension to create custom capabilities for the Joomla! CMS.

TRANSCRIPT

  • 1. Sourcerer Create your own extensions for Joomla! Without needing to learn the full MVC model or a complicated IDE

2. Sourcerer An extension for Joomla! 2.5 or 3.x from Peter van Westen http://www.nonumber.nl 3. What is it? Sourcerer enables you to place PHP and any kind of HTML style code (including CSS and JavaScript) right into your content! Not only in your articles, but also in sections, categories, modules, components, META tags, etc. 4. What does that mean? Without needing to learn all that it takes to develop your own components, you can add custom capabilities to your Joomla! sites. 5. Environment Platform Linux Apache/PHP/Joomla! Sourcerer Bluefish myphpadmin 6. Platform Ubuntu 12.04LTS Either installed on a dedicated PC Or Virtual Machine 7. Oracle VirtualBox https://www.virtualbox.org/ 8. Download platform & extension pack 9. Download Ubuntu Desktop http://www.ubuntu.com/download/desktop 10. VirtualBox Install Run and accept the default options. (see video) 11. Create Ubuntu Virtual Machine Create New machine Options: Ubuntu Linux 1G memory 32G disk Change network to bridged 12. Install Ubuntu Click Start for the newly defined virtual machine When prompted, select your saved .iso image for Linux 13. Final Steps in Setting up development Environment Install Joomla Sourcerer (directly or via Extension Manager) JCE (optional) 14. Advanced Configuration Modify php.ini Settings for apache: /etc/php5/apache2 Settings for CLI: /etc/php5/cli Settings may need to be changed to increase memory, upload size, or execution time 15. Code Resources PHP site: www.php.net great for syntax and code samples Google Your friend for finding PHP code, and finding Joomla! API calls 16. Starting to code Open a terminal, become root Create a directory to put your PHP code Set ownership/permissions Open Bluefish 17. PHP key points Variables always start with $ Variables are automatically defined (mostly) Variable names are case sensitive If you mis-spell or mis-capitalize, it isn't the same variable =, == and === are not the same thing Error messages are cryptic Arrays use associative indexes, which can be very useful 18. Error Messages When a Joomla! page ends up white, malformed, or with an error message, check: /var/log/apache2/error.log Go to the end of the file, and look back until you find the first of what is usually a bunch of messages. If you're lucky the message will be useful, but it will at least give you a line number 19. A simple code snippet Create new article Click on insert code Between the tags, enter: printf(Today is %s
n,date(Y-m-d)); Save article, add menu item, open page. 20. The other way to insert source... Create a suitable directory (e.g. php under your installation root). Don't forget to set the ownership/permissions correctly. Reference your.php file by putting a require_once into your article between the {source}{/source} tags 21. Bluefish A simple but relatively useful editor, which is language aware. You'll probably prefer to run it as root, so open a terminal window, then sudo bash, and then bluefish& Click on New, then Save As, and start writing. The file you've created should be the one you've put into the require_once statement. 22. Monospace text from file 23. Match a string in a text file