<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Programming Answers &#187; Web Programming</title>
	<atom:link href="http://www.bogartcomputing.com/web-programming-answers/category/web-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bogartcomputing.com/web-programming-answers</link>
	<description>Joomla Programmer, PHP, Joomla, Zen-Cart, osCommerce, MySQL, CSS, XHTML, Ecommerce, Search Engine Marketing, Web Programming answers, often in their rawest form</description>
	<lastBuildDate>Sun, 20 Jun 2010 19:38:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>A heavily corrected Windows XP XAMPP Zend Framework Quickstart Tutorial Revision</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/213/a-heavily-corrected-windows-xp-xampp-zend-framework-quickstart-tutorial-revision/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/213/a-heavily-corrected-windows-xp-xampp-zend-framework-quickstart-tutorial-revision/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 03:46:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/?p=213</guid>
		<description><![CDATA[http://framework.zend.com/manual/en/learning.quickstart.intro.html With many thanks to commenter alstanto on: 2010-04-07 22:04:18 Download Zend Framework 1.10.5 from: http://downloads.zend.com/framework/1.10.5/ZendFramework-1.10.5.zip Pre-Tutorial Extract to c:\ZendFramework-1.10.5 Rename directory to c:\Zend Add to Environment Path: ;C:\Zend\bin;C:\Zend\library;C:\xampp\php Uncomment C:\xampp\apache\conf\httpd.conf Include conf/extra/httpd-vhosts.conf In C:\xampp\apache\conf\extra\httpd-vhosts.conf add: &#60;VirtualHost *:80&#62; DocumentRoot "c:\zs\quickstart\public" ServerName quickstart.local SetEnv APPLICATION_ENV "development" &#60;Directory c:\zs\quickstart\public&#62; DirectoryIndex index.php AllowOverride All Order allow,deny Allow from [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a title="zend framework quickstart  tutorial" href="http://framework.zend.com/manual/en/learning.quickstart.intro.html" target="_blank">http://framework.zend.com/manual/en/learning.quickstart.intro.html</a></p>
<p>With many thanks to commenter alstanto on: 2010-04-07 22:04:18</p>
<p><strong>Download Zend Framework 1.10.5 from:</strong><br />
<a title="zend framework " href="http://downloads.zend.com/framework/1.10.5/ZendFramework-1.10.5.zip" target="_blank">http://downloads.zend.com/framework/1.10.5/ZendFramework-1.10.5.zip</a></p>
<p><strong>Pre-Tutorial</strong></p>
<ul>
<li> Extract to c:\ZendFramework-1.10.5</li>
<li> Rename directory to c:\Zend</li>
<li>Add to Environment Path:
<pre>;C:\Zend\bin;C:\Zend\library;C:\xampp\php</pre>
</li>
<li>Uncomment C:\xampp\apache\conf\httpd.conf
<pre>Include conf/extra/httpd-vhosts.conf</pre>
</li>
<li>In C:\xampp\apache\conf\extra\httpd-vhosts.conf add:
<pre>&lt;VirtualHost *:80&gt;
DocumentRoot "c:\zs\quickstart\public"
ServerName quickstart.local
SetEnv APPLICATION_ENV "development"
&lt;Directory c:\zs\quickstart\public&gt;
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
&lt;/Directory&gt;
&lt;/VirtualHost&gt;
&lt;VirtualHost *:80&gt;
DocumentRoot C:\xampp\htdocs
ServerName localhost
&lt;/VirtualHost&gt;
</pre>
</li>
<li>In C:\WINDOWS\system32\drivers\etc\hosts add:</li>
<pre>127.0.0.1 quickstart.local</pre>
<p>This means your tutorial files are accessed via <a href="http://quickstart.local">http://quickstart.local</a></p>
<li>Uncomment C:\xampp\apache\conf\httpd.conf</li>
<pre>LoadModule rewrite_module modules/mod_rewrite.so
</pre>
<li>In C:\xampp\php\php.ini add ;c:\zend\library;  to include_path:
<pre>include_path = ".;C:\xampp\php\pear\;c:\Zend\library"</pre>
</li>
<li>In C:\xampp\php\php.ini, uncomment
<pre>extension=php_pdo.dll
extension=php_pdo_sqlite.dll</pre>
</li>
</ul>
<p><strong>Reboot</strong></p>
<p><strong>START tutorial</strong></p>
<p>http://framework.zend.com/manual/en/learning.quickstart.create-project.html</p>
<ul>
<li>Run zf command line tool:
<pre>start, run, cmd
cd \
mkdir zs
cd zs
zf create project quickstart</pre>
</li>
<li>This is not in the tutorial: add a rewrite rule to public/.htaccess so that the file looks as follows:
<pre>RewriteEngine On</pre>
<pre>RewriteCond %{REQUEST_FILENAME} -s [OR]</pre>
<pre>RewriteCond %{REQUEST_FILENAME} -l [OR]</pre>
<pre>RewriteCond %{REQUEST_FILENAME} -d</pre>
<pre>RewriteRule ^.*$ - [NC,L]</pre>
<pre>RewriteRule ^.*$ index.php [NC,L]</pre>
<pre>RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php</pre>
</li>
<li>View welcome page
<pre><a href="http://quickstart.local">http://quickstart.local</a></pre>
</li>
</ul>
<p><strong>CONTINUE tutorial</strong></p>
<p>http://framework.zend.com/manual/en/learning.quickstart.create-layout.html</p>
<ul>
<li>Return to the cmd line at C:\zs\quickstart
<pre>zf enable layout</pre>
</li>
<li>Edit C:\zs\quickstart\application\BootStrap.php. Add this method to the Bootstrap class:
<pre>protected function _initDoctype()
{
$this-&gt;bootstrap('view');
$view = $this-&gt;getResource('view');
$view-&gt;doctype('XHTML1_STRICT');
}
</pre>
</li>
<li> Add line to C:\zs\quickstart\application\configs\application.ini, production section:
<pre>resources.view[] =</pre>
</li>
<li>Replace the contents of C:\zs\quickstart\application\layouts\scripts\layout.phtml with:
<pre>&lt;!-- application/layouts/scripts/layout.phtml --&gt;
&lt;?php echo $this-&gt;doctype() ?&gt;
&lt;html xmlns="http://www.worg/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf- /&gt;
&lt;title&gt;Zend Framework Quickstart Application&lt;/title&gt;
&lt;?php echo $this-&gt;headLink()-&gt;appendStylesheet('/css/global.css') ?&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="header" style="background-color: #EEEEEE; height: x;"&gt;
&lt;div id="header-logo" style="float: left"&gt;
&lt;b&gt;ZF Quickstart Application&lt;/b&gt;
&lt;/div&gt;
&lt;div id="header-navigation" style="float: right"&gt;
&lt;a href="&lt;?php echo $this-&gt;url(
array('controller'=&gt;'guestbook'),
'default',
true) ?&gt;"&gt;Guestbook&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;?php echo $this-&gt;layout()-&gt;content ?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
</li>
<li>View new layout, note guestbook is not yet hooked up:
<pre>http://quickstart.local</pre>
</li>
</ul>
<p><strong>Continue tutorial</strong></p>
<p>http://framework.zend.com/manual/en/learning.quickstart.create-model.html</p>
<ul>
<li>Tutorial commands will not work in Windows. Tutorial asks you to run in cmd c:\zs\quickstart:
<pre>zf configure db-adapter "adapter=PDO_SQLITE&amp;dbname=APPLICATION_PATH '/../data/db/guestbook.db'" production</pre>
<p>The tutorial would also have you put all three databases in the [production] section. Instead run these commands:</p>
<pre>zf configure db-adapter "adapter=PDO_SQLITE&amp;dbname=APPLICATION_PATH \"/../data/db/guestbook.db\"" production
zf configure db-adapter "adapter=PDO_SQLITE&amp;dbname=APPLICATION_PATH \"/../data/db/guestbook-testing.db\"" testing
zf configure db-adapter "adapter=PDO_SQLITE&amp;dbname=APPLICATION_PATH \"/../data/db/guestbook-dev.db\"" development</pre>
</li>
</ul>
<p style="padding-left: 60px;"><strong>This is neither part of the tutorial NOR the project.<br />
If you want to use MySql instead of Sqlite:</strong></p>
<ul style="padding-left: 30px;">
<li> In c:/xampp/php/php.ini, uncomment
<pre style="padding-left: 90px;">extension=php_pdo_mysql.dll</pre>
</li>
<li> At cmd c:/zs/quickstart, run command (change to your dbname, host, username, password)
<pre style="padding-left: 90px;">zf configure db-adapter "adapter=PDO_MYSQL&amp;dbname=mydb&amp;host=localhost&amp;username=root&amp;password production</pre>
</li>
<li>Restart Apache</li>
<li>In localhost/phpmyadmin create database mydb</li>
</ul>
<ul>
<li>Create the db directory in cmd at c:\zs\quickstart (you don&#8217;t do this for mysql):
<pre>mkdir data\db
attrib -R data
</pre>
</li>
<li> At this point the tutorial would have you create scripts/schema.sqlite.sql and other database files. The tutorial took you through creating data\db, so it should also mention that scripts needs to be created. In cmd at C:\zs\quickstart:
<pre>mkdir scripts
</pre>
</li>
<li> Create c:/zs/quickstart/scripts/schema.sqlite.sql (for mysql name the file schema.mysql.sql)
<pre>-- scripts/schema.sqlite.sql
--
-- You will need load your database schema with this SQL.
CREATE TABLE guestbook (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
email VARCHAR(32) NOT NULL DEFAULT 'noemail@test.com',
comment TEXT NULL,
created DATETIME NOT NULL
);
CREATE INDEX "id" ON "guestbook" ("id");
</pre>
</li>
<li>Create c:/zs/quickstart/scripts/data.sqlite.sql (for mysql name the file data.mysql.sql)
<pre>-- scripts/data.sqlite.sql
--
-- You can begin populating the database with the following SQL statements.
INSERT INTO guestbook (email, comment, created) VALUES
('ralph.schindler@zend.com','Hello! Hope you enjoy this sample zf application!',DATETIME('NOW'));
INSERT INTO guestbook (email, comment, created) VALUES('foo@bar.com','Baz baz baz, baz baz Baz baz baz - baz baz baz.',DATETIME('NOW'));
</pre>
</li>
<li>Create scripts/load.sqlite.php (for mysql name the file load.mysql.php and change all script references from sqlite to mysql). The tutorial does not include &lt;?php and ?&gt;. Add these.
<pre>&lt;?php
// scripts/load.sqlite.php
/**
* Script for creating and loading database
*/
// Initialize the application path and autoloading
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
set_include_path(implode(PATH_SEPARATOR, array(
APPLICATION_PATH . '/../library',
get_include_path(),
)));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
// Define some CLI options
$getopt = new Zend_Console_Getopt(array(
'withdata|w' =&gt; 'Load database with sample data',
'env|e-s'    =&gt; 'Application environment for which to create database (defaults to development)',
'help|h'     =&gt; 'Help -- usage message',
));
try {
$getopt-&gt;parse();
} catch (Zend_Console_Getopt_Exception $e) {
// Bad options passed: report usage
echo $e-&gt;getUsageMessage();
return false;
}
// If help requested, report usage message
if ($getopt-&gt;getOption('h')) {
echo $getopt-&gt;getUsageMessage();
return true;
}
// Initialize values based on presence or absence of CLI options
$withData = $getopt-&gt;getOption('w');
$env      = $getopt-&gt;getOption('e');
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (null === $env) ? 'development' : $env);
// Initialize Zend_Application
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
// Initialize and retrieve DB resource
$bootstrap = $application-&gt;getBootstrap();
$bootstrap-&gt;bootstrap('db');
$dbAdapter = $bootstrap-&gt;getResource('db');
// let the user know whats going on (we are actually creating a
// database here)
if ('testing' != APPLICATION_ENV) {
echo 'Writing Database Guestbook in (control-c to cancel): ' . PHP_EOL;
for ($x = 5; $x &gt; 0; $x--) {
echo $x . "\r"; sleep(1);
}
}
// Check to see if we have a database file already
$options = $bootstrap-&gt;getOption('resources');
$dbFile  = $options['db']['params']['dbname'];
if (file_exists($dbFile)) {
unlink($dbFile);
}
// this block executes the actual statements that were loaded from
// the schema file.
try {
$schemaSql = file_get_contents(dirname(__FILE__) . '/schema.sqlite.sql');
// use the connection directly to load sql in batches
$dbAdapter-&gt;getConnection()-&gt;exec($schemaSql);
chmod($dbFile, 0666);
if ('testing' != APPLICATION_ENV) {
echo PHP_EOL;
echo 'Database Created';
echo PHP_EOL;
}
if ($withData) {
$dataSql = file_get_contents(dirname(__FILE__) . '/data.sqlite.sql');
// use the connection directly to load sql in batches
$dbAdapter-&gt;getConnection()-&gt;exec($dataSql);
if ('testing' != APPLICATION_ENV) {
echo 'Data Loaded.';
echo PHP_EOL;
}
}
} catch (Exception $e) {
echo 'AN ERROR HAS OCCURED:' . PHP_EOL;
echo $e-&gt;getMessage() . PHP_EOL;
return false;
}
// generally speaking, this script will be run from the command line
return true;
?&gt;
</pre>
</li>
<li> At the cmd c:\zs\quickstart
<pre>php scripts/load.sqlite.php --withdata</pre>
</li>
<li>At the cmd c:\zs\quickstart
<pre>zf create db-table Guestbook guestbook</pre>
</li>
<li>Create application/models/GuestbookMapper.php
<pre>&lt;?php
// application/models/GuestbookMapper.php
class Application_Model_GuestbookMapper
{
public function save($model);
public function find($id, $model);
public function fetchAll();
}
?&gt;
</pre>
</li>
<li>At the cmd c:\zs\quickstart
<pre>zf create model GuestbookMapper
</pre>
</li>
<li>Replace contents of application/models/GuestbookMapper.php with:
<pre>// application/models/GuestbookMapper.php
class Application_Model_GuestbookMapper
{
protected $_dbTable;
public function setDbTable($dbTable)
{
if (is_string($dbTable)) {
$dbTable = new $dbTable();
}
if (!$dbTable instanceof Zend_Db_Table_Abstract) {
throw new Exception('Invalid table data gateway provided');
}
$this-&gt;_dbTable = $dbTable;
return $this;
}
public function getDbTable()
{
if (null === $this-&gt;_dbTable) {
$this-&gt;setDbTable('Application_Model_DbTable_Guestbook');
}
return $this-&gt;_dbTable;
}
public function save(Application_Model_Guestbook $guestbook)
{
$data = array(
'email'   =&gt; $guestbook-&gt;getEmail(),
'comment' =&gt; $guestbook-&gt;getComment(),
'created' =&gt; date('Y-m-d H:i:s'),
);
if (null === ($id = $guestbook-&gt;getId())) {
unset($data['id']);
$this-&gt;getDbTable()-&gt;insert($data);
} else {
$this-&gt;getDbTable()-&gt;update($data, array('id = ?' =&gt; $id));
}
}
public function find($id, Application_Model_Guestbook $guestbook)
{
$result = $this-&gt;getDbTable()-&gt;find($id);
if (0 == count($result)) {
return;
}
$row = $result-&gt;current();
$guestbook-&gt;setId($row-&gt;id)
-&gt;setEmail($row-&gt;email)
-&gt;setComment($row-&gt;comment)
-&gt;setCreated($row-&gt;created);
}
public function fetchAll()
{
$resultSet = $this-&gt;getDbTable()-&gt;fetchAll();
$entries   = array();
foreach ($resultSet as $row) {
$entry = new Application_Model_Guestbook();
$entry-&gt;setId($row-&gt;id)
-&gt;setEmail($row-&gt;email)
-&gt;setComment($row-&gt;comment)
-&gt;setCreated($row-&gt;created);
$entries[] = $entry;
}
return $entries;
}
}
</pre>
</li>
<li>At c:\zs\quickstart cmd
<pre>zf create model Guestbook</pre>
</li>
<li>Replace contents of application/models/Guestbook.php with:
<pre>// application/models/Guestbook.php
class Application_Model_Guestbook
{
protected $_comment;
protected $_created;
protected $_email;
protected $_id;
public function __construct(array $options = null)
{
if (is_array($options)) {
$this-&gt;setOptions($options);
}
}
public function __set($name, $value)
{
$method = 'set' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
throw new Exception('Invalid guestbook property');
}
$this-&gt;$method($value);
}
public function __get($name)
{
$method = 'get' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
throw new Exception('Invalid guestbook property');
}
return $this-&gt;$method();
}
public function setOptions(array $options)
{
$methods = get_class_methods($this);
foreach ($options as $key =&gt; $value) {
$method = 'set' . ucfirst($key);
if (in_array($method, $methods)) {
$this-&gt;$method($value);
}
}
return $this;
}
public function setComment($text)
{
$this-&gt;_comment = (string) $text;
return $this;
}
public function getComment()
{
return $this-&gt;_comment;
}
public function setEmail($email)
{
$this-&gt;_email = (string) $email;
return $this;
}
public function getEmail()
{
return $this-&gt;_email;
}
public function setCreated($ts)
{
$this-&gt;_created = $ts;
return $this;
}
public function getCreated()
{
return $this-&gt;_created;
}
public function setId($id)
{
$this-&gt;_id = (int) $id;
return $this;
}
public function getId()
{
return $this-&gt;_id;
}
}
</pre>
</li>
<li> At cmd z:\zs\quickstart
<pre>zf create controller Guestbook</pre>
</li>
<li>Add these lines to c:\zs\quickstart\application\controllers\GuestbookController.php init method
<pre>$guestbook = new Application_Model_GuestbookMapper();
$this-&gt;view-&gt;entries = $guestbook-&gt;fetchAll();
</pre>
<p>So that GuestbookController.php indexAction now looks like this:</p>
<pre>// application/controllers/GuestbookController.php

public function indexAction()
{
$guestbook = new Application_Model_GuestbookMapper();
$this-&gt;view-&gt;entries = $guestbook-&gt;fetchAll();
}
</pre>
</li>
<li> Change out the contents of c:\zs\quickstart\application\views\scripts\guestbook\index.phtml with:
<pre>&lt;!-- application/views/scripts/guestbook/index.phtml --&gt;
&lt;p&gt;&lt;a href="&lt;?php echo $this-&gt;url(
array(
'controller' =&gt; 'guestbook',
'action'     =&gt; 'sign'
),
'default',
true) ?&gt;"&gt;Sign Our Guestbook&lt;/a&gt;&lt;/p&gt;
Guestbook Entries: &lt;br /&gt;
&lt;dl&gt;
&lt;?php foreach ($this-&gt;entries as $entry): ?&gt;
&lt;dt&gt;&lt;?php echo $this-&gt;escape($entry-&gt;email) ?&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;?php echo $this-&gt;escape($entry-&gt;comment) ?&gt;&lt;/dd&gt;
&lt;?php endforeach ?&gt;
&lt;/dl&gt;
</pre>
</li>
<li>View the guest book
<pre>http://quickstart.local</pre>
<p>Note that the sign guest book is not implemented yet</li>
</ul>
<ul style="padding-left: 30px;">
<li>At cmd c:\zs\quickstart
<pre>zf create form Guestbook</pre>
</li>
<li>Replace application/forms/Guestbook.php with:<br />
(add &lt;?php and ?&gt; which are missing in tutorial)</p>
<pre>&lt;?php
// application/forms/Guestbook.php
class Application_Form_Guestbook extends Zend_Form
{
public function init()
{
// Set the method for the display form to POST
$this-&gt;setMethod('post');
// Add an email element
$this-&gt;addElement('text', 'email', array(
'label'      =&gt; 'Your email address:',
'required'   =&gt; true,
'filters'    =&gt; array('StringTrim'),
'validators' =&gt; array(
'EmailAddress',
)
));
// Add the comment element
$this-&gt;addElement('textarea', 'comment', array(
'label'      =&gt; 'Please Comment:',
'required'   =&gt; true,
'validators' =&gt; array(
array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 20))
)
));
// Add a captcha
$this-&gt;addElement('captcha', 'captcha', array(
'label'      =&gt; 'Please enter the 5 letters displayed below:',
'required'   =&gt; true,
'captcha'    =&gt; array(
'captcha' =&gt; 'Figlet',
'wordLen' =&gt; 5,
'timeout' =&gt; 300
)
));
// Add the submit button
$this-&gt;addElement('submit', 'submit', array(
'ignore'   =&gt; true,
'label'    =&gt; 'Sign Guestbook',
));
// And finally add some CSRF protection
$this-&gt;addElement('hash', 'csrf', array(
'ignore' =&gt; true,
));
}
}

?&gt;
</pre>
</li>
<li>In c:\zs\quickstart cmd run
<pre>zf create action sign Guestbook
</pre>
</li>
<li>Replace application/controllers/GuestbookController.php signAction() with:
<pre>public function signAction()
{
$request = $this-&gt;getRequest();
$form    = new Application_Form_Guestbook();
if ($this-&gt;getRequest()-&gt;isPost()) {
if ($form-&gt;isValid($request-&gt;getPost())) {
$comment = new Application_Model_Guestbook($form-&gt;getValues());
$mapper  = new Application_Model_GuestbookMapper();
$mapper-&gt;save($comment);
return $this-&gt;_helper-&gt;redirector('index');
}
}
$this-&gt;view-&gt;form = $form;
}
</pre>
</li>
<li> Replace application/views/scripts/guestbook/sign.phtml contents with:
<pre>&lt;!-- application/views/scripts/guestbook/sign.phtml --&gt;
Please use the form below to sign our guestbook!
&lt;?php
$this-&gt;form-&gt;setAction($this-&gt;url());
echo $this-&gt;form;
</pre>
</li>
<li>View and add guestbook entries
<pre><a href="http://quickstart.local">http://quickstart.local</a></pre>
</li>
</ul>
<pre style="padding-left: 60px;">zf configure db-adapter "adapter=PDO_MYSQL&amp;dbname=zipforce&amp;host=localhost&amp;username=root&amp;password production</pre>
<p style="padding-left: 30px;"><strong>CONTINUE tutorial</strong></p>
<p>http://framework.zend.com/manual/en/learning.quickstart.create-form.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/213/a-heavily-corrected-windows-xp-xampp-zend-framework-quickstart-tutorial-revision/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Replace column substring SQL Server columns</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/109/replace-column-substring-sql-server-columns/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/109/replace-column-substring-sql-server-columns/#comments</comments>
		<pubDate>Thu, 21 Jun 2007 05:17:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/109/replace-column-substring-sql-server-columns/</guid>
		<description><![CDATA[Replace all instances of FINDTHIS with REPLACEWITHTHIS in columns COLUMN1 and COLUMN2 of table TABLE where those substrings are in fact found update TABLE set COLUMN1=REPLACE(COLUMN1,&#8217;FINDTHIS&#8217;,'REPLACEWITHTHIS&#8217;), COLUMN2=REPLACE(COLUMN2,&#8217;FINDTHIS&#8217;,'REPLACEWITHTHIS&#8217;) from TABLE where COLUMN1 like &#8216;%SUBSTRINGPIECE%&#8217; or COLUMN2 like &#8216;%SUBSTRINGPIECE%&#8217;]]></description>
			<content:encoded><![CDATA[<p></p><p>Replace all instances of FINDTHIS with REPLACEWITHTHIS in columns COLUMN1 and COLUMN2 of table TABLE where those substrings are in fact found</p>
<p>update TABLE set<br />
COLUMN1=REPLACE(COLUMN1,&#8217;FINDTHIS&#8217;,'REPLACEWITHTHIS&#8217;),<br />
COLUMN2=REPLACE(COLUMN2,&#8217;FINDTHIS&#8217;,'REPLACEWITHTHIS&#8217;)<br />
from TABLE<br />
where<br />
COLUMN1 like &#8216;%SUBSTRINGPIECE%&#8217; or COLUMN2 like &#8216;%SUBSTRINGPIECE%&#8217;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/109/replace-column-substring-sql-server-columns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zen Cart UPS XML does not work with zones</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/107/zen-cart-ups-xml-does-not-work-with-zones/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/107/zen-cart-ups-xml-does-not-work-with-zones/#comments</comments>
		<pubDate>Mon, 02 Apr 2007 08:59:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/107/zen-cart-ups-xml-does-not-work-with-zones/</guid>
		<description><![CDATA[You&#8217;re here because you want to run UPS XML for Zen Cart with zones. It configures ok if you have no zones set, but as soon as you add a zone it displays the &#8220;unconfigured&#8221; yellow icon. The admin and the catalog both use the same code to determine if a UPS rate exists. The [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>You&#8217;re here because you want to run UPS XML for Zen Cart with zones. It configures ok if you have no zones set, but as soon as you add a zone it displays the &#8220;unconfigured&#8221; yellow icon.</p>
<p>The admin and the catalog both use the same code to determine if a UPS rate exists. The problem is, the admin doesn&#8217;t care about where that zone is, but the shipping checkout wants it to match the recipient&#8217;s zone. So by definition the admin can never be configured because it never matches an empty &#8220;order&#8221; zone, there&#8217;s no concept of an order on the admin end but the admin will not mark the UPS xml as &#8220;configured&#8221; until it matches this ghost zone.</p>
<p>It might configure ok in your store, but only if it&#8217;s set to &#8220;no zone,&#8221; which means it&#8217;ll show up for any destination whether you want it to or not. As soon as you try to add a zone it refuses to configure.</p>
<p>The fact is that whole paragraph of code was off, I wonder if people are using this module successfully. There&#8217;s NO WAY you could ever have configured it to do zones!</p>
<p>Change includes/modules/shipping/upsxml.php (upsxml.php,v 1.1.4 2004/12/19) right after the curl code setup to the following:</p>
<p>if (($this->enabled == true) &#038;&#038; ((int)MODULE_SHIPPING_UPSXML_RATES_ZONE > 0)) {<br />
$this->enabled=false;<br />
if (empty($order->delivery['country']['id'])) {<br />
$admin=true; }else{$admin=false;<br />
}<br />
/*<br />
$check = $db->Execute(&#8220;select zone_id from &#8221; . TABLE_ZONES_TO_GEO_ZONES . &#8221; where geo_zone_id = &#8216;&#8221; . MODULE_SHIPPING_UPSXML_RATES_ZONE . &#8220;&#8216; and zone_country_id = &#8216;&#8221; . $order->delivery['country']['id'] . &#8220;&#8216; order by zone_id&#8221;);<br />
*/<br />
if ($admin) {<br />
$sql = &#8220;select zone_id  from &#8221; . TABLE_ZONES_TO_GEO_ZONES . &#8221; where geo_zone_id = &#8216;&#8221; . MODULE_SHIPPING_UPSXML_RATES_ZONE.&#8221;&#8216;&#8221;;<br />
} else {<br />
$sql = &#8220;select zone_id  from &#8221; . TABLE_ZONES_TO_GEO_ZONES . &#8221; where zone_id=&#8217;&#8221;. $order->delivery['zone_id'] . &#8220;&#8216; and geo_zone_id = &#8216;&#8221; . MODULE_SHIPPING_UPSXML_RATES_ZONE . &#8220;&#8216;&#8221;;<br />
}</p>
<p>$check = $db->Execute($sql);<br />
if (!$check->EOF) {<br />
$this->enabled = true;<br />
}<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/107/zen-cart-ups-xml-does-not-work-with-zones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmatically determine Joomla homepage</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/106/programmatically-determine-joomla-homepage-2/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/106/programmatically-determine-joomla-homepage-2/#comments</comments>
		<pubDate>Sat, 17 Mar 2007 12:01:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/106/programmatically-determine-joomla-homepage-2/</guid>
		<description><![CDATA[If both mod_rewrite and 301&#8242;s are out in full force the home page is not going to be identifiable by a Server query_string containing &#8220;frontpage.&#8221; To determine if the current code is on the home page: $s = filter_var($_REQUEST['QUERY_STRING'], FILTER_SANITIZE_SPECIAL_CHARS); if (empty($s)) { //you&#8217;re on the home page }]]></description>
			<content:encoded><![CDATA[<p></p><p>If both mod_rewrite and 301&#8242;s are out in full force the home page is not going to be identifiable by a Server query_string containing &#8220;frontpage.&#8221; To determine if the current code is on the home page:</p>
<p>$s = filter_var($_REQUEST['QUERY_STRING'], FILTER_SANITIZE_SPECIAL_CHARS);<br />
if (empty($s)) {</p>
<p>//you&#8217;re on the home page</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/106/programmatically-determine-joomla-homepage-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VirtueMart Authorize.net Code Changes</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/103/virtuemart-authorizenet-code-changes-3/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/103/virtuemart-authorizenet-code-changes-3/#comments</comments>
		<pubDate>Tue, 27 Feb 2007 01:38:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Authorize.net]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[VirtueMart]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/103/virtuemart-authorizenet-code-changes-3/</guid>
		<description><![CDATA[VirtueMart does not automate Authorize.net test mode. It doesn&#8217;t read classes/payment/ps_authorize.cfg.php AN_TEST_REQUEST to see if it should send test mode to Authorize.Net. A quick fix, alter FILE CHANGE classes/ps_checkout.php lines 24, 159, 484 line 24: define (TESTMODE,true); Lines 159, 484, call validate with TESTMODE rather than hard-coded &#8220;false.&#8221; 159: if ( !$this->validate_payment_method( $d, TESTMODE )) [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><strong><em>VirtueMart does not automate Authorize.net test mode. It doesn&#8217;t read classes/payment/ps_authorize.cfg.php AN_TEST_REQUEST to see if it should send test mode to Authorize.Net. A quick fix, alter </em></strong></p>
<p align="left">FILE CHANGE classes/ps_checkout.php lines 24, 159, 484<br />
line 24:<br />
define (<strong>TESTMODE</strong>,true);</p>
<p>Lines 159, 484, call validate with TESTMODE rather than hard-coded &#8220;false.&#8221;<br />
159:<br />
if ( !$this->validate_payment_method( $d, <strong>TESTMODE</strong> )) {<br />
484:<br />
if (!$this->validate_payment_method($d, <strong>TESTMODE</strong>)) { //Change false to true to Let the user play with the VISA Testnumber</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/103/virtuemart-authorizenet-code-changes-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Restoring SQL bak for data backed up on a different machine</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/91/restoring-sql-bak-for-data-backed-up-on-a-different-machine/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/91/restoring-sql-bak-for-data-backed-up-on-a-different-machine/#comments</comments>
		<pubDate>Wed, 27 Dec 2006 09:56:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.Net programming]]></category>
		<category><![CDATA[Microsoft SQL Server]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/91/restoring-sql-bak-for-data-backed-up-on-a-different-machine/</guid>
		<description><![CDATA[Â &#8221;the physical file name&#8221; &#8220;may be incorrect&#8221;RESTORE DATABASE DBName FROM DISK = &#8216;C:\mypath\backedUpDb.bak&#8217; WITH MOVE &#8216;backedUpDb_dat&#8217; TO &#8216;C:\mypath\DBName.mdf&#8217;, MOVE &#8216;backedUpDb_log&#8217; TO &#8216;C:\mypath\DBName.ldf&#8217; GO Where DBName is the name the db will have on your local machine backedUpDb.bak is the backup with the wrong physical path backedUpDb_dat and backedUpDb_log are described below mdf and ldf are [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><font color="#0000ff" size="2">Â &#8221;the physical file name&#8221; &#8220;may be incorrect&#8221;</font><font color="#0000ff" size="2"></font><font color="#0000ff" size="2">RESTORE</font><font size="2"> </font><font color="#0000ff" size="2">DATABASE</font><font size="2"> DBName<br />
</font><font color="#0000ff" size="2">FROM</font><font size="2"> </font><font color="#0000ff" size="2">DISK</font><font size="2"> </font><font color="#808080" size="2">=</font><font size="2"> </font><font color="#ff0000" size="2">&#8216;C:\mypath\backedUpDb.bak&#8217;<br />
</font><font color="#0000ff" size="2">WITH</font><font size="2"><br />
MOVE </font><font color="#ff0000" size="2">&#8216;backedUpDb_dat&#8217;</font><font size="2"> </font><font color="#0000ff" size="2">TO</font><font size="2"> </font><font color="#ff0000" size="2">&#8216;C:\mypath\DBName.mdf&#8217;</font><font color="#808080" size="2">,<br />
</font><font size="2">MOVE </font><font color="#ff0000" size="2">&#8216;backedUpDb_log&#8217;</font><font size="2"> </font><font color="#0000ff" size="2">TO</font><font size="2"> </font><font color="#ff0000" size="2">&#8216;C:\mypath\DBName.ldf&#8217;<br />
</font><font size="2">GO</font></p>
<p><font size="2">Where<br />
DBName is the name the db will have on your local machine<br />
backedUpDb.bak is the backup with the wrong physical path<br />
backedUpDb_dat and backedUpDb_log are described below<br />
mdf and ldf are the names and locations you want DBName to have after restoration</font></p>
<p><font size="2">Â Get backedUpDb_dat from:<br />
SQL Enterprise or Management Studio<br />
Databases<br />
Restore Database<br />
To Database [DBName]<br />
From Device: [click ...]<br />
Backup Media<br />
File<br />
Add<br />
Browse to backedUpDb.bak<br />
OK<br />
Select Restore checkbox<br />
Options<br />
The Original Filename is you backedUpDb_dat and backedUpDb_log</font><font size="2">Options<br />
<font size="2" /><font size="2" /><font size="2" /></font><font size="2"></font><font size="2">Â </p>
<p></font>Â </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/91/restoring-sql-bak-for-data-backed-up-on-a-different-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VirtueMart Product Details Page SEO Title Tags</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/82/virtuemart-product-details-page-seo-title-tags-2/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/82/virtuemart-product-details-page-seo-title-tags-2/#comments</comments>
		<pubDate>Wed, 27 Sep 2006 22:08:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Search Engine Optimization]]></category>
		<category><![CDATA[Web Marketing]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/82/virtuemart-product-details-page-seo-title-tags-2/</guid>
		<description><![CDATA[In &#8220;administrator components com_virtuemart html shop.product_details.php,&#8221; add the category name to the page title $mainframe-&#62;setPageTitle( html_entity_decode( substr($category_name.&#8221; &#8220;.$product_name, 0, 60 ) ));]]></description>
			<content:encoded><![CDATA[<p></p><p>In &#8220;administrator components com_virtuemart html shop.product_details.php,&#8221; add the category name to the page title <textarea cols="80"> $mainframe-&gt;setPageTitle( html_entity_decode( substr($category_name.&#8221; &#8220;.$product_name, 0, 60 ) ));</textarea></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/82/virtuemart-product-details-page-seo-title-tags-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VirtueMart Category Page SEO Title Tags</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/80/virtuemart-category-page-seo-title-tags/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/80/virtuemart-category-page-seo-title-tags/#comments</comments>
		<pubDate>Wed, 27 Sep 2006 20:14:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[Search Engine Marketing]]></category>
		<category><![CDATA[Search Engine Optimization]]></category>
		<category><![CDATA[Web Marketing]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/80/virtuemart-category-page-seo-title-tags/</guid>
		<description><![CDATA[In order to set keyword-rich title tags on a VirtueMart category listing page: In &#8220;administrator components com_virtuemart html shop.index_sdm.php&#8221; (your mileage may vary on file name), add and initialize a $title variable in the top: $title=&#8221;"; After setting the category name, append the category to the title: $catname = shopMakeHtmlSafe($db->f(&#8220;category_name&#8221;)); $title .=$catname.&#8221;,&#8221;; This presumes your [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>In order to set keyword-rich title tags on a VirtueMart category listing page:</p>
<p>In &#8220;administrator components com_virtuemart html shop.index_sdm.php&#8221; (your mileage may vary on file name), add and initialize a $title variable in the top:</p>
<p><textarea cols="80">$title=&#8221;";</textarea></p>
<p>After setting the category name, append the category to the title:</p>
<p><textarea cols="80">$catname = shopMakeHtmlSafe($db->f(&#8220;category_name&#8221;));   $title .=$catname.&#8221;,&#8221;;</textarea><br />
This presumes your shop.index page calls</p>
<p><textarea cols="80">$mainframe->setPageTitle($title);</textarea></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/80/virtuemart-category-page-seo-title-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Painful 301 domain redirect discoveries using Joomla com_sef 404sef</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/65/painful-301-domain-redirect-discoveries-using-joomla-com_sef-404sef/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/65/painful-301-domain-redirect-discoveries-using-joomla-com_sef-404sef/#comments</comments>
		<pubDate>Mon, 24 Jul 2006 06:47:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Search Engine Optimization]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/65/painful-301-domain-redirect-discoveries-using-joomla-com_sef-404sef/</guid>
		<description><![CDATA[Answers the question: How to redirect domains given tools .htaccess, parked domain redirect and Joomla component 404sef. If you use Joomla and care at all about search engine rankings you&#8217;ll have to use a SEF translation of some kind. I chose 404sef and I&#8217;m grateful for what it does. Here&#8217;s how to get around something [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><strong>Answers the question:<br />
How to redirect domains given tools .htaccess, parked domain redirect and Joomla component 404sef.</strong><br />
If you use Joomla and care at all about search engine rankings you&#8217;ll have to use a SEF translation of some kind. I chose 404sef and I&#8217;m grateful for what it does. Here&#8217;s how to get around something it doesn&#8217;t do, which is handling non-primary domains.<br />
It will make Search Enging Friendly links for the current domain, but if you redirect a different domain to the 404Sef&#8217;d one the component will cough up a hair ball.</p>
<p align="left"><strong>Setup:</strong></p>
<ol>
<li>
<div align="left">Joomla 1.0.10</div>
</li>
<li>
<div align="left"><a title="SEF404 component PR1" href="http://sourceforge.net/forum/forum.php?forum_id=465328">SEF404 PR1</a></div>
</li>
<li>
<div align="left">Siteground.com hosting cpanel with parked domains</div>
</li>
<li>
<div align="left">Global config: SEF on</div>
</li>
<li>
<div align="left">SEF404 config: SEF on</div>
</li>
<li>
<div align="left"><a title="SEF checker" href="http://www.webconfs.com/redirect-check.php">webconfs.com search engine friendly redirect checker</a></div>
</li>
<li>
<div align="left"><a title="404sef htaccess" href="http://www.bogartcomputing.com/web-programming-answers/49/a-complete-guide-to-404sef-with-joomla/">.htaccess reflects 3rd party SEO</a></div>
</li>
<li>
<div align="left">primary domain <a href="http://www.bombshelters.com/">http://www.bombshelters.com/</a></div>
</li>
<li>
<div align="left">secondary domains that need to redirect in a search engine friendly way to <a href="http://www.bombshelters.com/">http://www.bombshelters.com/</a>:</div>
</li>
</ol>
<p>biologicalprotection.com<br />
biologicalshelter.com<br />
biologicalshelter.us<br />
biologicalshelters.com<br />
biologicalshelters.us<br />
blastshelters.com<br />
blastshelters.us<br />
bombshelter.us<br />
chemicalprotection.us<br />
combatshelter.com<br />
disastershelter.com<br />
falloutshelter.us<br />
governmentprotection.com<br />
nbcshelter.com<br />
nbcshelter.us<br />
nuclearprotection.us<br />
nuclearshelter.us<br />
nuclearshelters.com<br />
radiusdefense.com<br />
radiusengineering.us<br />
radiusengineeringinternational.com<br />
radiusengineeringintl.com<br />
radiusshelters.com<br />
saferoomprotection.us<br />
shelterengineering.com<br />
shelterprotection.us<br />
sheltersystems.us<br />
survivalshelter.us<br />
survivalshelters.us<br />
undergroundshelter.us<br />
undergroundshelterengineering.com<br />
undergroundshelters.com<br />
undergroundshelters.us<br />
wmdprotection.us<br />
<strong>Setup secondary domains to resolve to primary domain</strong></p>
<p align="left">These domains are all registered on network solutions. I changed the primary and secondary name servers on all of them to the siteground name server for bombshelters.com. Then on cpanel for bombshelters.com I used the &#8220;parked domains&#8221; tool to point each of the domains to bombshelters.com.</p>
<p align="left">This worked, and then broken suddenly tonight. It actually probably broke when I installed 404SEF I just didn&#8217;t realize it.</p>
<p align="left"><strong>Symptoms</strong></p>
<p align="left">I guess I had 404SEF off when I redirected the domains to the bombshelters.com name server because m initial tests worked great. You&#8217;d type undergroundshelter.us and the browser would display bombshelters.com content under the undergroundshelter.us address bar. When I tried that tonight I got &#8220;this page cannot be displayed.&#8221;</p>
<p align="left">The pubic_html errorlog pointed to:</p>
<p>[24-Jul-2006 00:58:57] PHP Warning: strpos() [<a href="http://www.bogartcomputing.com/web-programming-answers/function.strpos">]: Empty delimiter. in /home/bombshel/public_html/components/com_sef/sef404.php on line 83</a><a href="http://www.bogartcomputing.com/web-programming-answers/function.strpos" /><a href="http://www.bogartcomputing.com/web-programming-answers/function.strpos"></p>
<p align="left">[23-Jul-2006 23:04:24] PHP Fatal error: Call to undefined function: sefreltoabs() in /home/bombshel/public_html/components/com_content/content.html.php on line 584</p>
<p align="left"><strong>Things that don&#8217;t fix the problem</strong></p>
<ol>
<li>
<div align="left">Turning off 404SEF: it fixes the problem but creates the old problem of unfriendly URLs</div>
</li>
<li>
<div align="left">Ensuring the strpos delimiter (and target) are not empty on sef404.php:</div>
</li>
<p align="left">[24-Jul-2006 00:58:57] PHP Warning: strpos() [<a href="http://www.bogartcomputing.com/web-programming-answers/function.strpos">function.strpos</a>]: Empty delimiter. in /home/bombshel/public_html/components/com_sef/sef404.php on line 83</p>
<p align="left"><strong>bold line below is line 83</strong></p>
<p align="left"><em>if (!empty($pathdata) &#038;&#038; (!empty($sefconfig->suffix)))</em></p>
<p align="left">{<br />
<strong>if (strpos($pathdata,$sefconfig->suffix) !== false)<br />
</strong>$path_array[$x] = str_replace($sefconfig->suffix,&#8221;",$pathdata);<br />
$x++;<br />
}
</p>
<p align="left">This is fine as far as it goes, it&#8217;s good to test inputs before assuming they have content, but it addresses a symptom, not a problem.</p>
<li>Similar to #2, defining sefRelAbs function against its will</li>
</ol>
<p></a>]: Empty delimiter. in /home/bombshel/public_html/components/com_sef/sef404.php on line 83]: Empty delimiter. in /home/bombshel/public_html/components/com_sef/sef404.php on line 83content.html.php:<br />
if (!function_exists(&#8216;sefRelToAbs&#8217;))<br />
{<br />
function sefRelToAbs($string) {}<br />
}<br />
<strong>What does work</strong></p>
<p align="left">In .htaccess rewrite any domain that is not <a href="http://www.bombshelters.com/">http://www.bombshelters.com/</a> to be <a href="http://www.bombshelters.com/">http://www.bombshelters.com/</a>. Works for &#8220;bombshelters.com&#8221; (without www), &#8220;falloutshelter.us,&#8221; and etc. secondary domains.<br />
RewriteCond %{HTTP_HOST} !bombshelters.com$ [NC]<br />
RewriteRule ^(.*)$ <a href="http://bombshelters.com/$1">http://bombshelters.com/$1</a> [L,R=301]</p>
<p><strong>Big</strong> thank you to <a href="http://enarion.net/web/apache/htaccess/redirect-www-and-no-www/">http://enarion.net/web/apache/htaccess/redirect-www-and-no-www/</a></p>
<div align="left">and <a title="SEF checker" href="http://www.webconfs.com/redirect-check.php">webconfs.com search engine friendly redirect checker</a></div>
<p>Â </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/65/painful-301-domain-redirect-discoveries-using-joomla-com_sef-404sef/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>404SEF Joomla Directories-as-Filenames</title>
		<link>http://www.bogartcomputing.com/web-programming-answers/63/404sef-joomla-directories-as-filenames/</link>
		<comments>http://www.bogartcomputing.com/web-programming-answers/63/404sef-joomla-directories-as-filenames/#comments</comments>
		<pubDate>Sat, 22 Jul 2006 05:46:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.bogartcomputing.com/web-programming-answers/63/404sef-joomla-directories-as-filenames/</guid>
		<description><![CDATA[Joomla&#8217;s 404SEF component can be tricky if you want to use directory names instead of file extensions, aka http://www.bombshelters.com/Education/Biological-Bioterror-Weapons-Effects not http://www.bombshelters.com/Education/Biological-Bioterror-Weapons-Effects.html First, lowercase is on by default. Second, default file extension of .html hurls your pages into deep space. To hae both, go to 404 config, set All Lowercase to No, set File Suffix to [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Joomla&#8217;s 404SEF component can be tricky if you want to use directory names instead of file extensions, aka</p>
<p><a href="http://www.bombshelters.com/Education/Biological-Bioterror-Weapons-Effects">http://www.bombshelters.com/Education/Biological-Bioterror-Weapons-Effects</a></p>
<p>not</p>
<p>http://www.bombshelters.com/Education/Biological-Bioterror-Weapons-Effects.html</p>
<p>First, lowercase is on by default. Second, default file extension of .html hurls your pages into deep space.</p>
<p>To hae both, go to 404 config, set All Lowercase to No, set File Suffix to a blank textbox.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogartcomputing.com/web-programming-answers/63/404sef-joomla-directories-as-filenames/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
