Tuesday, January 31, 2012

[Joomla] Be a Super Administrator!

Sometimes we are curious of what goes at the back. And being "only" a registered user can't seem to get rid of that curiosity. So here's a way on how to change your ACL status.

Assuming you have database access. If you don't have any I'm afraid you can't proceed to the next steps.

First, let's create a test user.

Save your new user and make sure you remember the important details (refer to image above)

Now, let's go to the database. Open jos_users and look for the test user that you just created.

Change the gid into 25 and usertype into Super Administrator.

[Joomla] Execute Modules Manually

Modules are easy to execute given that it can be place anywhere as long you assign it to a specific position but what if you want to display a module within a component?

Here's the code on how to load a single module:
$module = JModuleHelper::getModule('mod_module','modtitle'); 
echo JModuleHelper::renderModule($module);

The downside with this is it won't apply its parameters. I think there's a way on how to do this but I haven't figure it out yet.

A Thought to Ponder

The best way to appreciate your job
is to imagine yourself without one

Saturday, January 28, 2012

A Thought to Ponder

The greatest weapon to deceive others is to smile


Are those GIFs above familiar? Yes, they are what we call preloaders. They let the users know that a certain page or data was still loading or processing at the moment. Even a simple phrase, "Please wait a moment, processing data..." is called a preloader.

Usually, preloaders are used in registration validation, installers, searching and many more. The most common site I know who uses this is facebook. Look at the fourth GIF above, how many times have you seen that in facebook, huh?

But what's its used? Are they just some decorations on the site?

Yes, they are somewhat a decoration or something but a useful decoration. Imagine when a site is still processing a data and all it this is a white screen, you'll most likely think that the site has stop responding because all you can see is just plain white. So you'll end up refreshing the page. But using a preloader, you know that a certain site was still loading a data.


Friday, January 27, 2012

[PHP] Get Whole URL in Address Bar

Sample URL: http://www.google.com/pacman/

We will use two PHP functions:


Code 1:


Code 2:

To get the whole URL:
echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

Wednesday, January 25, 2012

[Joomla] Copy Backend Pagination Style to Frontend

Using Pagination in frontend have a different look compared from the backend



If you compare the two, of course the backend pagination style is much better. So I will discuss on how to override the frontend pagination so that it will be the same with the backend.

First, look for /administrator/templates/khepri/html/pagination.php and copy the contents of pagination_list_footer($list) and pagination_list_render($list) functions.

Second, look for /templates//html/pagination.php and remove the contents of pagination_list_footer($list) and pagination_list_render($list) functions then paste those codes you copied from the first step.

Third, copy the /administrator/templates/khepri/css /general.css file to your /templates//css/. Of course you could manually copy the css scripts you only needed for the pagination but you may miss to copy some to it’s better to just copy the whole css file.

Fourth, go to /administrator/templates/khepri/images/ and copy all images that its filename starts with j_button2. Then paste them to /templates//images/

There you have it! Backend pagination style now on your frontend. enjoy learning. =D

[jQuery] Change Element Class Name

  <span class=”old_class”>hello there!</span>

Change the class using jQuery:
$('div span').removeClass('old_class').addClass('new_class');

  <span class="new_class">hello there!</span>

Colossians 3:17

And whatever you do, whether in word or deed, do it all in the name of the Lord Jesus, giving thanks to God the Father through him.

Tuesday, January 24, 2012

A Though to Ponder

Only music can let us sing
Only music can make our feet dance
And only music can let our mind reminiscing back to our past
but what’s important about music is
they can be the voice of what we feel inside
especially when we are mute by the words of our hearts


I always hate tracing an error. How, where, when did the error occur? Arrg, I hate that. I'd rather start from scratch than trace an error.

Anyways, enough of my rambling. I encountered this error while creating a component:


Possible problem with this type of error is incorrect link to view or misspelled view name. Or the worst, you forgot to create the view (hahaha...)

[Joomla] Error: View cannot be found

You created a component, everything was perfect. It runs in your local drive the way you expect it to be, but once you installed it on live server, it says "View Cannot Be Found"

What's wrong, it's running just in fine in my local? Did I misspelled a file or a folder? Did I forgot to assign the view? The model?

If your answers to those questions are NO and you know it yourself that nothing's wrong, then maybe you got the problem in how you capitalized the letters in your file names or folders names.

In Windows, "myComponent" is equal with "mycomponent" while in Linux, "myComponent" is "myComponent" not "mycomponent".

Got it?

So it's better to not use PascalCasing or camelCasing in your file names and folder names just to be safe.

It's just one small mistake but believe me, I've been figuring out the error for hours without knowing that I just need to convert to small letters my component's folder names.

PascalCasing and camelCasing

PascalCasing is where the first letter of each word is in upper case. It's the same with ucwords in php. This is usually used in naming a class.

camelCasing is where the first letter of the first word is in lowercase while the first letter of the subsequent words are in uppercase. It's the same with ucwords in php except that the first letter is in lowercase. This is usually used in naming a function or variables.

Monday, January 23, 2012

A Though to Ponder

Life may not always be easy
but it will always be beautiful
if you allow it to be

Luke 1:37

For with God nothing is impossible

[Joomla] Load Module within an Article

{loadposition module}

loadposition indicates that a module is about to be loaded

module is the position of the module that will be loaded

But what if you only want to load a specific module in a particular position? There two ways to do this. The first is a trick with the position name while the other is using a third party plugin.

1. Trick with the position name

Though the Position value is a drop down, it is editable so you can freely change it in any word you want. So using the position in the image above, the syntax now would be:
{loadposition loadarticle}

2. Third party plugin
You can download the plugin here

The syntax is like this:
{module [63]}

For versions 2 and up, module chromes like none, xhtml, rounded can be define:
{module [63|rounded]}

A Thought to Ponder

Everything is possible
if only one will see
through the eyes of a child

Sunday, January 22, 2012

Nested Parentheses

Problem: Write a program to determine if a string consists of properly nested parentheses



Saturday, January 21, 2012

[MySQL] Inner Join, Left Join, Right Join

Often, common joins such as Inner Join, Left Join and Right Join confused people so I will have little demonstration to compare the difference between the three.

Sample Tables:
| id   | name    | location |
|    1 | erin    |        1 |
|    2 | roran   |        2 |
|    3 | vincent |        1 |
|    4 | travis  |        0 |

| id   | place      |
|    1 | california |
|    2 | new york   |
|    3 | tenessee   |
|    4 | hawaii     |
|    5 | italy      |

Inner Join:
INNER JOIN displays only the fields from User table who have pairs on Location table
SELECT User.id, User.name, Location.place
INNER JOIN Location on User.location=Location.id;
| id   | name    | place      |
|    1 | erin    | california |
|    2 | roran   | new york   |
|    3 | vincent | california |

Left Join:
LEFT JOIN displays the all fields from User table then display place field its paired of
SELECT User.id, User.name, Location.place
LEFT JOIN Location on User.location=Location.id;
| id   | name    | place      |
|    1 | erin    | california |
|    2 | roran   | new york   |
|    3 | vincent | california |
|    4 | travis  | NULL       |

Right Join:
RIGHT JOIN displays the all fields from Location table then display id and name fields its paired of
SELECT User.id, User.name, Location.place
RIGHT JOIN Location on User.location=Location.id;
| id   | name    | place      |
| NULL | NULL    | tenessee   |
| NULL | NULL    | hawaii     |
| NULL | NULL    | italy      |
|    1 | erin    | california |
|    2 | roran   | new york   |
|    3 | vincent | california |

Note: In the example above, User table was referred as the left table while Location table was referred to as Right table

[Joomla] Load CSS and Javascript

Load CSS:
$document =& JFactory::getDocument();

Load Javascript:
$document =& JFactory::getDocument();

jQuery noConflict():
$document =& JFactory::getDocument();

Note: In loading a script, the path should be a url, not a directory.

Modulus 11

Problem: create a program which will ask for an input number and determine whether it is a multiple of 11. Range: 1-100 digits (not one to one hundred, but 100 digits)

CLUE: use string for the input for even the long long int cannot hold a 100-digit number



[Joomla] Content or Modules not showing

If you are creating your own Joomla template instead of downloading one online, you might have encountered this codes:
<jdoc:include type="component">
<jdoc:include type="modules" name="sidebar">

Looking at those codes, it seems that nothing’s wrong with them but once you run your Joomla site, the content and modules under sidebar position are not showing.

The problem? You forgot to add the slash( / ) at the end. So the correct code must be like this:
<jdoc:include type="component" />
<jdoc:include type="modules" name="sidebar" />

To know more about Jdoc statement click here

Count Without Loops

Problem: write a program to display number from 1-10 without using any looping statements (for, while, do) and only using one parameter.



Friday, January 20, 2012

A Though to Ponder

The mind of a writer is not as organized
as his work appears to be

Thursday, January 19, 2012

Even Small Things Can Make a Day Worthwhile

I was getting ready for my day and by 5:45 am, I’m already out of the house walking down the familiar path for me to get my ride. As I was walking, I see the things and scenarios that usually occur at that time of the day. Trisikad drivers trying to get my attention asking me if I want to get a ride, taxi drivers having their early breakfast or simply sleeping inside their cabs, and I even cross paths again with the old man wearing his usual attire, an old style hat, white button down shirt and white shorts, having his usual morning jog. In other words "just another normal day".

Just when I was about to turned around the corner, I met an unfamiliar face. He also was an old man, I think he’s already around sixties, also having his morning jog. It’s nothing unusual, at first, but he suddenly waved at me, smiled and said "Gandang umaga! God bless you!" For a split second, I was simply taken aback and before I knew it, I was smiling. I remember back in my college days, there’s this priest who smiled and greets everyone he met.
Related Posts Plugin for WordPress, Blogger...