Today I wanted to show you how easy it is to add a content editor in your Joomla component form.
Today I want to show you how to set multiple markers in Google Maps V.3 with each marker having their own infowindow.
Today I want to talk about how you would go about creating a CSV file from scratch, with all of your data from the database.
First we want to have the array of States in our code. See Below.
$states = array("AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID",
"IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH",
"NJ","NM","NV","NY","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA",
"WI","WV","WY");
Then you want to create the list (select list options). Above is the simplest way of creating a state array, but right now the key of each array is 0, 1, 2. This is not what we want, we want the key and value of the array to be the same. So this next line fixes just that.
Below is how you set the page title for a Joomla 1.5 component.
With MVC, the standard place to put this code is going to be the view.html.php file inside your view folder.
$document = JFactory::getDocument();
$document->setTitle('Title of Page');
And that is it. Leave the comments below, hope this helped!
Today I want to show you how easy it is to set a redirect in your Joomla Component. Below is the easiest way to go about this.
$app = JFactory::getApplication();
$app->redirect($link, $msg);
You will want to make sure that there are variables set for $link and $msg. Also this is best used with an IF statement. Here is a full example on how to use the redirect.
if($user->guest):
$link = 'index.php';
$msg = 'You are not logged in.';
$app = JFactory::getApplication();
$app->redirect($link, $msg);
endif;
Wanted to show you how easy it is to use the DISTINCT function in MySQL inside of Joomla.
This is very useful whenever you want to create a list of all the individual values of a specific field in a database table. It only gets that value once, so like below, there is several "Burlington" values in the city field
Table: jos_locations
| id | name | city | state |
| 1 | Coffee House | Graham | NC |
| 2 | Barnes & Nobile | Burlington | NC |
| 3 | Sheetz | Mebane | NC |
| 4 | Starbucks | Burlington | NC |
| 5 | Panera | Burlington | NC |
So this is how you would use distinct to just grab that list of specific values.
// Get a database object
$db = &JFactory::getDBO();
$query = ' SELECT DISTINCT city '.
' FROM #__ locations ';
Now we want to Set the Query.
$db->setQuery($query);
Finally we send the query and return the Results and print it out.
$results = $db->loadObjectList();
print_r($results);
The results will be in an object oriented list like this:
Array ( [0] => stdClass Object ( [city] => Graham ) [1] => stdClass Object ( [city] => Burlington ) [2] => stdClass Object ( [city] => Mebane ) )
So let me know what you think, and hope this helped!
Here is a very easy way to learn how to make link anchors on your website!
This line of code is an example of a inputbox that has a default text in it, until the user clicks on it and then it sets itself to nothing. This is very useful if you want to have default text in your inputbox.
<INPUT type="text" value="Email Address" onfocus="if(this.value==this.defaultValue) this.value='';">
Also if they click out of the box, and they did not fill anything out then click away to another box or area, you can put this in, and it will put whatever you want back in there.
onblur="if(this.value=='') this.value='Email Address';"
Here are the examples on how to check if the user is using any Internet Explorer browser or a specific one with only HTML code.
<!--[if IE]>
This checks for Internet Explorer
<![endif]-->
<!--[if lte IE 6]>
This checks for less than or equal to Internet Explorer 6
<![endif]-->
<!--[if IE 7]>
This checks for Internet Explorer 7
<![endif]-->
Example of use:
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="/ie6_hacks.css" />
<![endif]-->