Web

26th

Sep

This tutorial tells you how to make static pages for Joomla! 1.0.12 & 1.0.13 and what they are generally used for.

Many website owners are still using Joomla’s “stable” versions as opposed to using the newest version 1.5 RC2, which is, by the way, a complete overhaul and still a “Release Candidate”, as the RC implies. If you are using 1.0.12 & 1.0.13 you can refer to this tutorial for static pages.

what are static pages used for in a dynamic environment?

You can use them for making thankyou pages for purchased content, for emails or registration pages – that is, if you want your own custom page and not a page that a content management system automatically makes for you. You can also use them for pages that usually don’t change in content, like an “about us”, a “contact” page, for help screens and privacy policies.

The way I handle my static pages is to make a menu that is not present on the site, aka a “fake” menu which holds all static page links on the site. No-one will see this menu displayed on the site if you don’t set it to be published in the module manager. Likewise, if you assign the menu to a position that is not coded into your template, the menu will still be loaded but it won’t be seen. You choose. You do not need to make a different menu necessarily, but you may find it more efficient to have these pages separated from your “real” menus, especially if you have a large site with many links. I have my links to static pages in a menu called (how boring) “other menu”.

tutorial

As I mentioned in the tutorial for MathGuard 2.0, here is the simple and quick solution to making a static thankyou page for your contact page.

1. Navigate to your static content manager and click on “new” in the top right-hand menu.

2. Now, create your static page as you would like it to look. Give it a meaningful title, add images to the content if you like or write a message that you would like the user to see once the email has been sent. That may be a message like, “Thankyou for your email. Please allow up to 24 – 48 hours for a reply” or what ever text you would like to be displayed.

3. Change the Parameters on the right-hand side to suit your site. Personally, I don’t type in any Meta Data because this page shouldn’t be able to be indexed in a search engine and it only should be displayed when a user has sent an email successfully. If you created a menu for static links before-hand, it will show up along with your other menus used on the site under the “Link To Menu” tab. Here you need to click on the menu you would like to place the link into to highlight it, give the link a name and click the button “Link To Menu”.
Pic of Parameters Panel
Then SAVE.

4. Navigate to your menu and you should see link to your static page.

5. Click on the menu item and the menu item’s details will be displayed. You can now change whether the link will be opened in a new window with or without browser navigation or the same (parent) window. I personally just let it open the static page in the same window. Other things you could change are pretty straightforward but basically, you don’t need to alter anything as it is automatically set to be published and the access level is “Public”.

What you should do is to tick the box “yes” to give it a unique Itemid in the right-hand panel. After that, click “save”. Now you’re back in the menu’s list, so you need to go click on your link again to get to the details. On the left-hand side you will see the URL of your link. Copy this URL by highlighting it and using the keyboard keys Ctrl c.
Pic of static content menu item URL

6. Now, go to the menu which contains the link to your contact page. (Don’t copy anything else in the meantime otherwise your saved to clipboard URL will be lost and you’ll have to go back to get the link again). Click the contact link and the contact page’s details will be displayed. Here you can set all the parameters for this link. Scroll right down to the bottom of this page and on the right-hand side there is a box named “Thank You Page URL”. Paste the URL you copied into this box and you’re all set.

This concludes this tutorial. I hope it was helpful to you.

Tags:
© 2007

4th

Sep

This will help you implement Math Guard 2.0. in Joomla’s contact form, step-by-step.

First, download the zip file from Code Gravity. Extract the zip file to a temporary folder anywhere on your harddrive. Preferably, a place that you will remember.

1. Now, open up ClassMathGuard.php in a text editor or a html editor of your choice and add the following line to it, at the top, just underneath <?php

// no direct access
defined( ‘_VALID_MOS’ ) or die( ‘Restricted access’ );

this will ensure that no-one has access to this file outside of Joomla.

Then, upload that file – only that file – to your /components/com_contact/ directory. FYI – you don’t need the rest, part of Math Guard’s formhandler.php is inserted into contact.php later on in this tutorial.

2. Find the contact component (/components/com_contact/) in your joomla installation and open contact.html.php

Find:

<?php
<if ( $params->get( 'email_copy' ) ) {
?>
<br />
<input type="checkbox" name="email_copy" id="contact_email_copy" value="1" />
<label for="contact_email_copy">
<?php echo(_EMAIL_A_COPY); ?>
</label>
<?php
}
?>
<br />
<br />

and between the 2 break tags at the end (<br />) insert the following:

<?php require("ClassMathGuard.php"); MathGuard::insertQuestion(); ?>

Of course, you can add break tags if you want the Math Guard question to have more space above and below it.

3. Now you must define an error message in case the user added up the 2 digits incorrectly. If the email is not sent, then the user is not directed to anywhere after implementing Math Guard – the user (email sender) ends up on a blank page, so you need to make the re-directs yourself ~ in addition to adding Math Guard’s code.

So, first things first, please navigate to /language/ and open english.php. Scroll down to find line 145 (it should be at that line) and change it’s contents to something that reflects the error the user experienced. To be precise, this is what is displayed to the user after the error happened. I changed it to this, you may want to do the same:

DEFINE(’_ERROR_MESSAGE’,'Your email wasn\’t sent! Please provide the correct answer.’);

4. Next, find the following code in /components/contact.php, it’s near the top:

switch( $op ) {
case 'sendmail':
sendmail( $con_id, $option );
break;
}

and swap it out with:

switch( $op ) {
case 'sendmail':
require ("ClassMathGuard.php");
if (MathGuard :: checkResult($_REQUEST['mathguard_answer'], $_REQUEST['mathguard_code'] ) ) { sendmail( $con_id, $option );
} else {
$link = sefRelToAbs( ‘index.php?option=com_contact&task=view&contact_id=’. $contact[0]->id .’&Itemid=’. $Itemid );
mosRedirect( $link, _ERROR_MESSAGE );
}
break; }

Quick breakdown: It calls ClassMathGuard.php and then checks the result of what the user typed as an answer. If the answer is correct, the email is sent (sendmail…). If the answer is incorrect this calls up the contact form again and tells the user at the top of the form that they gave the wrong answer (else… do this). If you study the code a little, you can tell what’s going on. I’m not a php expert, I searched for the redirect code and it’s in contact.php further down for their “thankyou” re-direct hack and I used that, so I didn’t re-invent the wheel. LOL. The error message, as you can see, is inserted from the language file we edited before.

We’re done. =D

I hope you found this tutorial easy to follow. =)

Btw, you can see it in action on my Sims 1 site which is Joomla 1.0.13 powered. I had to remove Joomla as it was supposedly using too many server resources as a download site. :(

A big thanks to Code Gravity for MathGuard. It’s great!

What? You want to know how to set up a thankyou page? Well, Joomla redirects to a thankyou page just fine without you doing anything but all it does really is to output a “thankyou for your email” at the top of the page and reloads the contact form. If you want to have one styled to your site and not have it reload the contact form, then… O.k… a small tut will be up soon. =)

Tags:
© 2007

3rd

Sep

As Joomla! users already know, Joomla doesn’t come configured with any security regarding forms out of the box. Why this isn’t already part of Joomla, eludes me.

Spending a lot of time searching for a good method to use, that was not complicated to implement, I found two that do the job. However, for a person new to these kinds of things, everything is complicated… The first listed below is the one that most people try to implement first because it’s listed at Joomla’s Extension site. The second isn’t actually an extension for Joomla. It is written in PHP and, basically, it can be implemented anywhere you need it, in any php environment.

1. Security Images by Walter Cedric
:: works pretty much ok if you install it correctly and patch it etc and you also have the GD Library with linkage to TrueTypeFonts installed but from reading some of the comments from the Joomla Extension site about this, it seems there are quite a few people who either a) “don’t get it”… or b) don’t get it to function properly or even c) don’t get it to function at all. It is kind of bloated and does interfere the design.

2. Math Guard by Code Gravity
:: this functions superbly, is unobtrusive, doesn’t fudge up the design and is my method of choice – I also reckon that most users are able to add up two single digits. =p It’s not bloated – only 1 file really. However, with this one some files need to be changed manually, per hand and you need to know what to change. Here is a step-by-step guide on how to do just that:

How to Implement Math Guard 2.0

Tags:
© 2007