Showing posts with label Joomla. Show all posts
Showing posts with label Joomla. Show all posts

September 16, 2007

Joomla Component Front End

Hello Guys,

I know there are a lot of Free Joomla Component out there, but what if what is out there is not exactly what you need?


This will be the first post in creating a simple Joomla Component.

In a Joomla Component there are 2 required files, first the scripting side and the html output side.

First were gonna tackle on the scripting side:

Lets make the name of our component "example".

If you are a Joomla / Mambo you can clearly see in the url the "option=com_componentname"

Then the files located are in the "/components/com_componentname/componentname.php" and "/components/com_componentname/componentname.html.php"

The "componentname.php" file is the scripting file where you usually execute database queries, variable manipulation etc.

The "componentname.html.php" file is where you usually display the result and add html tags so that you can manipulate the design of the output.

So we will first tackle the scripting side file.

so we need to create a folder inside "/components" named "com_example" and inside the com_example folder we create a php file called example.php.

Inside example.php:


defined( '_VALID_MOS' ) or die( 'Restricted access' );
// this is required so that we will have access on the browser in viewing this component, another Joomla security measure so that people wont accidentally see your pages.

require_once( $mainframe->getPath( 'front_html' ) );
//this line calls and loads the html side of the component.

switch($task){
//this line takes the task value in the url and chooses what function to execute.
default:
//this is chosen when the the task value is empty.
display_hello_world();
//calling the function
break;
//exists the switch function
}

function display_hello_world(){
$name = "Place Name Here";
//adding a name variable
HTML_example::hello_world($name);
//calling the function in html file and passing the variable name
//the HTML_example is the class name inside the html file, and the hello_world() is a function inside that class.
}


Next Post will discuss the html side so stay tuned...

September 15, 2007

Software Freedom Day

Yoyoyo!

Today Sept. 15 is Software Freedom Day this is the day where we celebrate the liberation from Propriety softwares :)

I don't have against propriety softwares they are good and excellent, but for a programmer that is on a tight budget and want to learn some programming, why not go for free softwares? :)

I personally appreciate the people behind this liberation because without them we all still would have to buy softwares just to learn firsthand.

Specially to the Joomla Core Developers, man if not for these people, making websites will still be in manual, yes there are still manual codings to make in order to make the site to look and feel like what you imagine, but you don't have to do them all :)

Again thanks for all the Software Liberators :)

Long Live Open Source :)