Archive

Archive for December, 2008

Automatic Data Backup Of Database

December 30th, 2008

As a PHP Programmer you should know the importance of having a database backup

Have you ever been typing something or finishing up a document and suddenly lost electricity? More than likely we did not save that document. It can be very frustrating to lose such documentation but you can always “just” start a new one. After all, it’s “just” a document…

Sure…. or You can use our automatic backup software to backup all of your databases or back them up on command. This script will send the SQL file to your email this way you have an extra database backup. You can later use these to restore database info or create new ones from saved files.

I am selling a script that will allow you to generate a data backup:

Click Below to purchase $7.95:

Automatic Database Backup

Don’t wait for your database to crash, back it up automatically or on demand with this simple to install PHP Script.

Uncategorized

JobberBase SEO Mod

December 7th, 2008

Search Engine Optimization is important if you want to show high in the search engine results pages. Many webmasters pay big money to have a SEO company optimize their websites. I am the lead programmer for such a company and found JobberBase while searching for a job search website that I could utilize for personal use. I fell in love with it right away, but noticed that it did not have SEO tags that were easily editable by the user/webmaster. So I started adding code and came up with the following tutorial, this tutorial will show you how to add SEO capabilities to your JobberBase website.  I tried to make this as simple as possible, so enjoy:

Backup your database and your files before attempting this install

1. Alter db table:

ALTER TABLE `categories` ADD `title` TEXT NOT NULL AFTER `var_name` ,
ADD `description` TEXT NOT NULL AFTER `title` ,
ADD `keywords` TEXT NOT NULL AFTER `description` ;

2. In “admin/_templates/categories.tpl”:

Find:

<a href=”#” title=”Save” class=”saveCategory”><img src=”{$BASE_URL}img/disk.png” alt=”Save” /> Save</a>

Add After:

<label><span>Title:</span><input type=”text” size=”60″ name=”title[{$category.id}]” value=”{$category.title}” /></label>
<label><span>Description:</span><input type=”text” size=”60″ name=”desc[{$category.id}]” value=”{$category.description}”/></label>
<label><span>Keywords:</span><input type=”text” size=”60″ name=”keys[{$category.id}]” value=”{$category.keywords}” /></label>

3. In “_includes/functions.php”:

Find:

function get_categories()
{
global $db;
$categories = array();
$sql = ‘SELECT id, name, var_name
FROM categories
ORDER BY `category_order` ASC’;
$result = $db->query($sql);
while ($row = $result->fetch_assoc())
{
$categories[] = array(’id’ => $row['id'], ‘name’ => $row['name'], ‘var_name’ => $row['var_name']);
}
return $categories;
}

Change to:

function get_categories()
{
global $db;
$categories = array();
$sql = ‘SELECT *
FROM categories
ORDER BY `category_order` ASC’;
$result = $db->query($sql);
while ($row = $result->fetch_assoc())
{
$categories[] = array(’id’ => $row['id'], ‘name’ => $row['name'], ‘var_name’ => $row['var_name'], ‘title’ => $row['title'], ‘description’ => $row['description'], ‘keywords’ => $row['keywords']);
}
return $categories;
}

4. In “admin/page_categories.php”:

Find:

case ’saveCategory’:
$result = $db -> query(’
UPDATE
`categories`
SET
`var_name` = \” . $_POST['url'] . ‘\’,
`name` = \” . $_POST['name'] . ‘\’
WHERE
`id` = ‘ . intval($_POST['category']) . ‘
‘);

break;

Change to:

case ’saveCategory’:
$result = $db -> query(’
UPDATE
`categories`
SET
`var_name` = \” . $_POST['url'] . ‘\’,
`name` = \” . $_POST['name'] . ‘\’,
`title` = \” . $_POST['title'] . ‘\’,
`description` = \” . $_POST['description'] . ‘\’,
`keywords` = \” . $_POST['keywords'] . ‘\’
WHERE
`id` = ‘ . intval($_POST['category']) . ‘
‘);
break;

Then Find:

$last = $result->fetch_assoc();
$db->query(’
INSERT INTO
`categories`
VALUES (
NULL,
\’enter a name\’,
\’custom url\’,
‘ . (intval($last['category_order']) + 1) . ‘
)
‘);

Change to:

$last = $result->fetch_assoc();
$db->query(’
INSERT INTO
`categories`
VALUES (
NULL,
\’enter a name\’,
\’custom url\’,
\’SEO Title\’,
\’SEO Description\’,
\’SEO Keywords\’,
‘ . (intval($last['category_order']) + 1) . ‘
)
‘);

5. In “admin/js/categories.js”:

Find:

‘img/disk.png” alt=”Save” /> Save</a>’,

Add After:

‘<label><span>Title:</span><input type=”text” size=”60″ name=”title[]” value=”newcategory” /></label>’,
‘<label><span>Description:</span><input type=”text” size=”60″ name=”description[]” value=”newcategory” /></label>’,
‘<label><span>Keywords:</span><input type=”text” size=”60″ name=”keywords[]” value=”newcategory” /></label>’,

KEEP FILE OPEN

6. In the same file, “categories.js”:

Find:

name: $(el).parent().find(’input:first’).val(),

Add after:

title: $(el).parent().find(’input:eq(1)’).val(),
description: $(el).parent().find(’input:eq(2)’).val(),
keywords: $(el).parent().find(’input:eq(3)’).val(),

KEEP FILE OPEN

7. In the same file, “categories.js”

Find:

.find(’input:first’)
.attr(’name’, ‘name[' + id + ']‘)
.end()

Add after:

.find(’input:text.eq(1)’)
.attr(’name’, ‘title[' + id + ']‘)
.end()
.find(’input:text.eq(2)’)
.attr(’name’, ‘description[' + id + ']‘)
.end()
.find(’input:text.eq(3)’)
.attr(’name’, ‘keywords[' + id + ']‘)
.end()

8. In the file, “/page_category.php”

[b]NOTE:[/b] [u]Not[/u] the “/admin/page_category.php”

Find:

$html_title = ‘Are you looking for ‘ . $extra . ‘ ‘ . $id . ‘ jobs?’;
$meta_description = ”;

Replace with:

$smarty->assign(’seo_title’, get_seo_title($id));
$smarty->assign(’seo_desc’, get_seo_desc($id));
$smarty->assign(’seo_keys’, get_seo_keys($id));

9. In the file, “/_includes/functions.php”

Find:

function get_categories()
{
*** Removed to save space ***
}

Add After:

function get_seo_title($id)
{
global $db;
$sql = ‘SELECT *
FROM categories
WHERE var_name = “‘.$id.’”‘;
$result = $db->query($sql);
$row = $result->fetch_assoc();
return $row['title'];
}
function get_seo_desc($id)
{
global $db;
$sql = ‘SELECT *
FROM categories
WHERE var_name = “‘.$id.’”‘;
$result = $db->query($sql);
$row = $result->fetch_assoc();
return $row['description'];
}
function get_seo_keys($id)
{
global $db;
$sql = ‘SELECT *
FROM categories
WHERE var_name = “‘.$id.’”‘;
$result = $db->query($sql);
$row = $result->fetch_assoc();
return $row['keywords'];
}

10. In “/_templates/header.tpl”

Find:

<title>{$html_title}</title>
<meta http-equiv=”Content-Type” content=”application/xhtml+xml; charset=utf-8″ />
<meta name=”description” content=”{$meta_description}” />
<meta name=”keywords” content=”{$meta_keywords}” />

Replace with:

<title>{$seo.title}</title>
<meta name=”description” content=”{$seo_desc}” />
<meta name=”keywords” content=”{$seo_keys}” />
<meta http-equiv=”Content-Type” content=”application/xhtml+xml; charset=utf-8″ />

11. In “/page_home.php”

Find:

$html_title = $translations['homepage']['title'] . SITE_NAME;

Replace with:

$smarty->assign(’seo_title’, “This is the homepage title”);
$smarty->assign(’seo_desc’, “This is the homepage Description”);
$smarty->assign(’seo_keys’, “This is the homepage keyword”);

Change that last set of information to set you homepage SEO values.

If you have any questions I will be more than happy to discuss them here. If there are any errors I apologize ahead of time as this was done late last night. My time is tight but figured this one to be useful to people.

Thank you JobberBase for your hard work and efforts. Great App!!

PHP