<?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>MindPalette.com &#187; Development Blog</title>
	<atom:link href="http://www.mindpalette.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mindpalette.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 07 Apr 2012 01:35:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Ajax Form Submission in Joomla 2.5 with jQuery</title>
		<link>http://www.mindpalette.com/development/ajax-form-submission-in-joomla-2-5-with-jquery/</link>
		<comments>http://www.mindpalette.com/development/ajax-form-submission-in-joomla-2-5-with-jquery/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 23:59:26 +0000</pubDate>
		<dc:creator>Nate</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Joomla!]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.mindpalette.com/?p=451</guid>
		<description><![CDATA[I&#8217;m developing a custom c-commerce component for Joomla 2.5, and today was struggling with using Ajax from my admin lists. I wanted to make small changes to the list via Ajax without having to reload the entire page &#8211; publish state, deletes, quick edits, etc. To handle the Ajax form submissions, I was using jQuery [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m developing a custom c-commerce component for Joomla 2.5, and today was struggling with using Ajax from my admin lists. I wanted to make small changes to the list via Ajax without having to reload the entire page &#8211; publish state, deletes, quick edits, etc. To handle the Ajax form submissions, I was using <a href="http://jquery.com/">jQuery</a> and the <a href="http://jquery.malsup.com/form/">jQuery Form Plugin</a>.<span id="more-451"></span></p>
<p>The problems I ran into mostly had to do with working around the built-in Joomla JavaScript and admin form submission handling. Perhaps there&#8217;s a better way, but here is how I got things to work:</p>
<ol>
<li>Manually call Joomla&#8217;s core scripts in the view&#8217;s layout file.</li>
<li>Override the Joomla functions &#8220;Joomla.submitbutton&#8221; and &#8220;submitbutton&#8221;.</li>
<li>Intercept form submissions from inside the Joomla.submitbutton function.</li>
<li>Update the necessary hidden fields manually and push through the form via Ajax.</li>
</ol>
<h3>1. Manually call Joomla&#8217;s core scripts in the view&#8217;s layout file.</h3>
<p>This step was necessary when overriding the Joomla functions with my own. Without doing this, Joomla&#8217;s functions will be imported last, and will override your, erm, overrides. It&#8217;s easy enough to to &#8211; include this bit of PHP at the top of your view&#8217;s layout file:</p>
<pre class="brush:php">&lt;?php
$document =&amp; JFactory::getDocument();
JHTML::_('behavior.mootools');
$document-&gt;addScript('/path/to/my_javascript.js');
?&gt;</pre>
<p>So, first you use JHTML to bring in the core Joomla JS files, then you attach your own JS file afterwards to handle the overrides.</p>
<h3>Override the Joomla functions &#8220;Joomla.submitbutton&#8221; and &#8220;submitbutton&#8221;.</h3>
<p>The primary override will be to the new Joomla.submitbutton method. Mine looked something like this:</p>
<pre class="brush:js">Joomla.submitbutton = function(task){
	if (task == 'publish' || task == 'unpublish'){
		jQuery('input[name=format]', jQuery('#adminForm')).val('json');
		jQuery('input[name=task]', jQuery('#adminForm')).val(task);
		jQuery('#adminForm').ajaxSubmit();
	} else Joomla.submitform(task);
	return false;
};</pre>
<p>This example intercepts form submissions for the publish or unpublish tasks. My form has a hidden field named &#8220;format&#8221; with the default value of &#8220;html&#8221; for a normal form submission. The script above first changes that to a format of &#8220;json&#8221;, and then my Controller can check for the format field and send the correct response and view.</p>
<p>I&#8217;m also having to manually set the &#8220;task&#8221; hidden field, since we&#8217;re stealing that functionality from Joomla&#8217;s core scripts. Finally, we do the ajaxSubmit call (this assumes you&#8217;ve already added jQuery and the jQuery Form Plugin to your document). In my real world script, I also passed some parameters to the ajaxSubmit() function, such as the callback functions for successful submissions and errors.</p>
<p>For me, this all worked when using the list checkboxes and the toolbar buttons at the top, but not when clicking the publish or unpublish column graphics in the list. The problem there seemed to be that the publish/unpublish graphics were going through the Joomla listItemTask() function, which, for whatever reason, was still using the older submitbutton() function (not attached to the Joomla object). This override was pretty simple &#8211; I just routed it through to the other:</p>
<pre class="brush:js">function submitbutton(task) {
	return Joomla.submitbutton(task);
}</pre>
<p>That got things working for me. My ajaxSubmit() callbacks handled the refresh of the list, and there are obviously some app-specific details I&#8217;ve left out, but hopefully this helps point someone (or me, later) in the right direction.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindpalette.com/development/ajax-form-submission-in-joomla-2-5-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Admin Quickicon in Joomla! 2.5</title>
		<link>http://www.mindpalette.com/uncategorized/custom-admin-quickicon-in-joomla-2-5/</link>
		<comments>http://www.mindpalette.com/uncategorized/custom-admin-quickicon-in-joomla-2-5/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 16:32:32 +0000</pubDate>
		<dc:creator>Nate</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mindpalette.com/?p=429</guid>
		<description><![CDATA[I recently had to dig up how to add a custom admin Quickicon (the icon links on the left side of the Administrator section&#8217;s control panel) in Joomla 2.5. In previous versions, I&#8217;d just built a custom admin module for each icon. Now, there seems to be a somewhat easier way.Adding an icon to the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to dig up how to add a custom admin Quickicon (the icon links on the left side of the Administrator section&#8217;s control panel) in Joomla 2.5. In previous versions, I&#8217;d just built a custom admin module for each icon. Now, there seems to be a somewhat easier way.<span id="more-429"></span>Adding an icon to the main list is a bit less straightforward. If you look in the default module:</p>
<pre>/administrator/modules/mod_quickicon</pre>
<p>&#8230;you&#8217;ll see that the whole list is being generated and wrapped in a div with class=&#8221;cpanel&#8221;. What we want to do is add our own custom icon to the list before this happens. In the helper.php file, see the modQuickIconHelper::getButtons() method for details.</p>
<p>Instead of creating a new admin module, we need to build a custom plug-in that adds additional icons to that list before it is output. Joomla is already doing this in recent versions, and you can find examples here:</p>
<pre>/plugins/quickicon</pre>
<p>Chances are, these examples are more complicated than you need since they&#8217;re using Ajax to check the version/update status of Joomla or your installed extensions. Here is a simplified example plugin:</p>
<p><a href="http://www.mindpalette.com/wp-content/uploads/mycustomicon.zip">Download mycustomicon.zip Example Plugin</a> &raquo;</p>
<p>Inside the zip archive, see the main plugin file &#8220;mycustomicon.php&#8221;:</p>
<pre class="brush:php">&lt;?php defined('_JEXEC') or die;

class plgQuickiconMycustomicon extends JPlugin
{
    public function onGetIcons($context)
    {
        if (
            $context == $this-&gt;params-&gt;get('context', 'mod_quickicon')
            &amp;&amp; JFactory::getUser()-&gt;authorise('core.manage', 'com_content')
        ){
            return array(array(
                'link' =&gt; 'index.php?option=com_content',
                'image' =&gt; 'header/icon-48-component.png',
                'text' =&gt; 'Quickicon Example',
                'id' =&gt; 'plg_quickicon_mycustomicon'
            ));
        } else return;
    }
}</pre>
<p>We&#8217;re hooking to the onGetIcons event, and:</p>
<ul>
<li>Check the context and permissions (lines 7 &#8211; 9)</li>
<li>Add our own icon to the list (lines 11 &#8211; 16)</li>
<li>Return null</li>
</ul>
<p>The &#8220;id&#8221; value will need to be unique for each icon. For the &#8220;image&#8221; value, use the relative path from:</p>
<pre>/administrator/templates/bluestork/images</pre>
<p>(or whichever admin template you&#8217;re using). If you&#8217;d like to use a custom icon image, enter the absolute path to that image, including &#8220;http://&#8221; &#8230;my first guess was that I could just start the path with a / and Joomla would know that the image path was absolute, but that did not appear to work without the fully qualified http:// address.</p>
<p>See Joomla&#8217;s update icons for better examples that make use of language files and what-not.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindpalette.com/uncategorized/custom-admin-quickicon-in-joomla-2-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forcing NULL date field values in Joomla 1.7 JTable</title>
		<link>http://www.mindpalette.com/development/null-date-fields-in-joomla-1-7-jtable/</link>
		<comments>http://www.mindpalette.com/development/null-date-fields-in-joomla-1-7-jtable/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 03:08:50 +0000</pubDate>
		<dc:creator>Nate</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Joomla!]]></category>

		<guid isPermaLink="false">http://www.mindpalette.com/?p=348</guid>
		<description><![CDATA[I&#8217;ve been upgrading my Joomla! knowledge from version 1.5 to 1.7, and ran into an issue with JTable where my date fields, though they had a NULL default in the database, were getting saved with a value of &#8217;0000-00-00&#8242; on save, presumably because the value was being sent as an empty string. The solution was [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been upgrading my Joomla! knowledge from version 1.5 to 1.7, and ran into an issue with JTable where my date fields, though they had a NULL default in the database, were getting saved with a value of &#8217;0000-00-00&#8242; on save, presumably because the value was being sent as an empty string.<span id="more-348"></span></p>
<p>The solution was simple enough. In my custom JTable file, I added some code to the store method override to check for an empty string (or &#8217;0000-00-00&#8242;) in the date field(s), and if found, force back to null. Something like:</p>
<pre class="brush:html">public function check()
{
	// force empty date values to null
	if ($this-&gt;date_start == '' || $this-&gt;date_start == '0000-00-00')
		$this-&gt;date_start = null;
	return true;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mindpalette.com/development/null-date-fields-in-joomla-1-7-jtable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Printing to Mac OS Lion Shared Printer from Windows 7</title>
		<link>http://www.mindpalette.com/development/sharing-mac-10-7-lion-printer-with-windows-7-home-premium/</link>
		<comments>http://www.mindpalette.com/development/sharing-mac-10-7-lion-printer-with-windows-7-home-premium/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 03:04:56 +0000</pubDate>
		<dc:creator>Nate</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.mindpalette.com/?p=330</guid>
		<description><![CDATA[I had some difficulty today trying to share my printer over the network with my wife&#8217;s new laptop running Windows 7 Home Premium. I&#8217;m not exactly sure which steps were all required, but I did end up getting it to work to where the Windows machine can now print to the Mac shared printer. Steps [...]]]></description>
			<content:encoded><![CDATA[<p>I had some difficulty today trying to share my printer over the network with my wife&#8217;s new laptop running Windows 7 Home Premium. I&#8217;m not exactly sure which steps were all required, but I did end up getting it to work to where the Windows machine can now print to the Mac shared printer. Steps I took:<span id="more-330"></span></p>
<ol>
<li>Upgraded the Mac machine to newest version (10.7.1 at the time)</li>
<li>Make sure printer sharing is enabled on the Mac under System Preferences / Sharing / Printer Sharing</li>
<li>Installed the needed print drivers on the Windows machine (in my case, an Epson Stylus NX125)</li>
<li>Installed <a href="http://support.apple.com/kb/dl999">Bonjour Print Services for Windows</a> on the Windows 7 machine</li>
<li>Used the Bonjour Printer Wizard in Windows 7 to find the shared Mac printer and set it up (selecting the appropriate driver, installed previously)</li>
<li>Made sure the printer status was &#8220;ready&#8221; (filled an ink cartridge that was complaining about being low)</li>
<li>Restarted both machine</li>
</ol>
<p>After all that, it seems to be working fine.</p>
<p>I did run into an odd bug where, after creating the Bonjour printer in Windows, it could not be deleted from the control panel. This was apparently caused by the @ sign in the printer name. The solution was to go into any application&#8217;s print dialog (I used Notepad), select the printer in the list and delete from there. I found that information here:<br />
<a href="http://support.microsoft.com/kb/975451">You cannot remove a printer that has the at sign (@) in its name from a computer that is running Windows 7</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindpalette.com/development/sharing-mac-10-7-lion-printer-with-windows-7-home-premium/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MAMP Apache Conf Disappeared Today</title>
		<link>http://www.mindpalette.com/development/mamp-apache-conf-disappeared/</link>
		<comments>http://www.mindpalette.com/development/mamp-apache-conf-disappeared/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 02:48:59 +0000</pubDate>
		<dc:creator>Nate</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.mindpalette.com/?p=325</guid>
		<description><![CDATA[I ran into some issues with my local MAMP installation today. I&#8217;m not sure if MAMP did a behind-the-scenes update, or if it&#8217;s somehow related to my OS update this evening to Mac OS X Lion 10.7.1. Basically, all my custom virtual host configurations disappeared from: /Applications/MAMP/conf/apache/httpd.conf I noticed that things got moved around, so [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into some issues with my local MAMP installation today. I&#8217;m not sure if MAMP did a behind-the-scenes update, or if it&#8217;s somehow related to my OS update this evening to Mac OS X Lion 10.7.1. Basically, all my custom virtual host configurations disappeared from:</p>
<pre class="brush:plain">/Applications/MAMP/conf/apache/httpd.conf</pre>
<p><span id="more-325"></span>I noticed that things got moved around, so now there&#8217;s an &#8220;extra&#8221; folder in the same directory as httpd.conf, which has the file &#8220;httpd-vhosts.conf&#8221;. Presumably, that&#8217;s where the virtual hosts now belong, so I grabbed a backup configuration file and pasted my virtual host configurations into httpd-vhosts.conf.</p>
<p>Then, I had to tell the main httpd.conf file to import the included httpd-vhosts.conf file by finding this block around line 525:</p>
<pre class="brush:plain">#Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf</pre>
<p>&#8230; and removing the # sign at the beginning to un-comment. After doing that, then re-starting the MAMP servers, everything was back to normal.</p>
<p>Also worth mentioning: I tried to use Time Machine to restore an old version of httpd.conf onto the desktop so I could copy the virtual host configurations for pasting, but for whatever reason, Time Machine kept restoring it as the newest version without the data I needed. I had to manually open my Time Machine backup drive, find the file in the backup archives and drag it to the desktop manually.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindpalette.com/development/mamp-apache-conf-disappeared/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joomla Component Preferences Button</title>
		<link>http://www.mindpalette.com/development/joomla-com-prefs-button/</link>
		<comments>http://www.mindpalette.com/development/joomla-com-prefs-button/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 00:11:43 +0000</pubDate>
		<dc:creator>Nate</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Joomla!]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.mindpalette.com/?p=303</guid>
		<description><![CDATA[I ran into a frustrating issue today while developing a custom component where the Preferences button would not show up. In case I&#8217;m not the only one that encounters this, here&#8217;s what happened&#8230; Basically, I was using a config.xml file with this: JToolBarHelper::preferences('com_mycompname'); &#8230;and when I loaded the page to test, no button was there. [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a frustrating issue today while developing a custom component where the Preferences button would not show up. In case I&#8217;m not the only one that encounters this, here&#8217;s what happened&#8230;</p>
<p><span id="more-303"></span>Basically, I was using a config.xml file with this:</p>
<pre class="brush:php">
JToolBarHelper::preferences('com_mycompname');
</pre>
<p>&#8230;and when I loaded the page to test, no button was there. Turns out it was just because I wasn&#8217;t logged in as an administrator (I believe it was with a Manager account). After logging out and then back in as admin, all was right with the world.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindpalette.com/development/joomla-com-prefs-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom 404 Error Pages in Joomla</title>
		<link>http://www.mindpalette.com/development/custom-joomla-custo-404-error-pages/</link>
		<comments>http://www.mindpalette.com/development/custom-joomla-custo-404-error-pages/#comments</comments>
		<pubDate>Thu, 05 May 2011 13:29:20 +0000</pubDate>
		<dc:creator>Nate</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Joomla!]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.mindpalette.com/?p=247</guid>
		<description><![CDATA[I&#8217;ve recently had to build custom 404 pages for a few Joomla sites, and it seems like every time it comes up, I have to dig around for the information again and look up how I did it last time. I&#8217;m posting the details here so it&#8217;s all in one place for me, and hopefully [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently had to build custom 404 pages for a few Joomla sites, and it seems like every time it comes up, I have to dig around for the information again and look up how I did it last time. I&#8217;m posting the details here so it&#8217;s all in one place for me, and hopefully it saves you some time and effort as well.<span id="more-247"></span></p>
<h2>Override the System Default Layout</h2>
<p>The basics of building a custom 404 error page in Joomla are fairly straightforward and can be found here: <a href="http://docs.joomla.org/Custom_error_pages">Custom Error Pages (Joomla!)</a></p>
<p>Long story short, copy this file:</p>
<pre class="brush:plain">/templates/system/error.php</pre>
<p>&#8230;to your active template&#8217;s folder:</p>
<pre class="brush:plain">/templates/(your template)/error.php</pre>
<p>To customize your error page(s), you can now make whatever edits you want to the error.php file in your active template folder, since this file will override the system default.</p>
<h2>Response Headers (Important!)</h2>
<p>It&#8217;s important to send the correct response headers so browsers (and search engine crawlers) know that what they are seeing is a 404 error page and not your normal site content. This is easy enough to do by adding a snippet of PHP code:</p>
<pre class="brush:php">error-&gt;code == '404')
header("HTTP/1.0 404 Not Found");</pre>
<p>This code must be placed before HTML output (including white space), so it may be a good idea to insert this snippet minus the  tags directly into the PHP block at the top of the error.php after the line:</p>
<pre class="brush:php">defined( '_JEXEC' ) or die( 'Restricted access' );</pre>
<h2>Using Modules and Menus in Custom Error Pages</h2>
<p>My first inclination was to just import my main template layout file like:</p>
<pre class="brush:php">include dirname(__FILE__) . "/index.php";</pre>
<p>&#8230;and then use a conditional in the tempalte index.php file to either display an error message or load the normal Component, like:</p>
<pre class="brush:html">&lt;?php if (isset($this-&gt;error) &amp;&amp; $this-&gt;error-&gt;code == '404'): ?&gt;
&lt;h1&gt;Error 404: Page Not Found&lt;/h1&gt;
&lt;?php else: ?&gt;
&lt;jdoc:include type="component" /&gt;
&lt;?php endif; ?&gt;</pre>
<p>&#8230;but unfortunately, not all of the features available in the template&#8217;s index.php file are available to the error.php file in Joomla &#8211; most notably, the jdoc tags and functions for working with Modules. You could opt to re-work the index.php file to not use any features that error.php does not support, but in my experience, it has been best to duplicate the index.php file and make an alternate version for use with error.php. Otherwise, there are just too many conditional tests and the template file becomes difficult to work with, particularly for someone less familiar with PHP.</p>
<p>I usually end up copying my index.php code into the error.php file, then give it a test run in the browser (by typing in a page address that does not exist in the site) and then fixing whatever PHP error messages come up from trying to use functions and features that are not available. Since this will vary depending on how your template&#8217;s index.php file is built, there will be a certain amount of trial-and-error involved. A few likely examples are listed below.</p>
<h3>Testing For and Outputting Modules</h3>
<p>Code like this will not work in error.php:</p>
<pre class="brush:html">&lt;?php if($this-&gt;countModules('left')) : ?&gt;
&lt;jdoc:include type="modules" name="left" style="rounded" /&gt;
&lt;?php endif; ?&gt;</pre>
<p>&#8230;since the countModules method is not available and the jdoc tag doesn&#8217;t parse. You can still bring Modules into the error page using PHP. Try the following (changing the position and output type as needed):</p>
<pre class="brush:php">&lt;?php
foreach (JModuleHelper::getModules('left') as $module)
print(JModuleHelper::renderModule($module, array('style'=&gt;'rounded')));
?&gt;</pre>
<h3>Head Section Content</h3>
<p>The head content import tag will also not work in error.php:</p>
<pre class="brush:html">&lt;jdoc:include type="head" /&gt;</pre>
<p>&#8230;so keep in mind that the title tag and an necessary system-imported CSS and JavaScript files will need to be added manually.</p>
<h2>Using an Article as 404 Error Message</h2>
<p>It is also possible to use an Article for the 404 error message content &#8211; this may be useful if you would like to give the end user control over the error page text without them having to edit the error.php file directly. For details, see this page: <a href="http://docs.joomla.org/Creating_a_Custom_404_Error_Page">Creating a Custom 404 Error Page</a>.</p>
<p>Personally, I don&#8217;t like that method because it does a redirect for the error page and doesn&#8217;t send the expected error page headers. Instead, you might consider using a Custom HTML Module to manage the error page content, then create a position that&#8217;s only used in the error.php file (for instance &#8220;errormsg&#8221;). You can use the PHP method above (under &#8220;Testing For and Outputting Modules&#8221;) to output the module position into your error page template.</p>
<h2>Conclusion</h2>
<p>I hope this is useful to others &#8211; I will likely be updating this document as I run into other issues. Please post any corrections or questions in the Comments section below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindpalette.com/development/custom-joomla-custo-404-error-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Center GoLive Layers Page</title>
		<link>http://www.mindpalette.com/development/center-golive-layers/</link>
		<comments>http://www.mindpalette.com/development/center-golive-layers/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 16:04:24 +0000</pubDate>
		<dc:creator>Nate</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[GoLive]]></category>

		<guid isPermaLink="false">http://www.mindpalette.com/?p=69</guid>
		<description><![CDATA[So, you&#8217;ve already designed your web page using GoLive layers (GoLive CS+) or floating boxes (GoLive 6 and older) and now you&#8217;d like that page to center in your browser window? The reason this is more complicated than it seems is because layers (read &#8220;floating boxes&#8221; if you&#8217;re using an older version of GoLive) have [...]]]></description>
			<content:encoded><![CDATA[<p>So, you&#8217;ve already designed your web page using GoLive layers (GoLive CS+) or floating boxes (GoLive 6 and older) and now you&#8217;d like that page to center in your browser window? The reason this is more complicated than it seems is because layers (read &#8220;floating boxes&#8221; if you&#8217;re using an older version of GoLive) have absolute positioning, and that positioning is measured from the top and left edges of the window. The top edge is no problem, but we need to make it measure from the center instead of the left edge. It&#8217;s not quite as simple as hitting a &#8220;center&#8221; button, but it&#8217;s not as difficult as it seems.<span id="more-69"></span></p>
<p>To get a Layers-based layout to center, we first need to add a wrapper DIV around the whole design. There&#8217;s no super-easy way to do this in GoLive&#8217;s layout editor, so switch to source view (this will be quick and painless, but it wouldn&#8217;t hurt to make a back-up first).</p>
<p>In source view, find the opening &lt;body tag (should be right after the closing &lt;/head&gt; tag). We need to add another line after the opening body tag &#8211; see arrow in image:</p>
<p><img class="alignnone size-full wp-image-74" title="code_fixedstart" src="http://www.mindpalette.com/wp-content/uploads/code_fixedstart.jpg" alt="code_fixedstart" width="205" height="76" /></p>
<p>Now we need to add the start tag for a &#8220;wrapper&#8221; div (to tell the browser what to center with).</p>
<p>Add &lt;div id=&#8221;wrapper&#8221;&gt; in the new line after the &lt;body&gt; tag to look something like this:</p>
<p><img class="alignnone size-full wp-image-75" title="code_centeredstart" src="http://www.mindpalette.com/wp-content/uploads/code_centeredstart.gif" alt="code_centeredstart" width="285" height="105" /></p>
<p>(The indenting isn&#8217;t important &#8211; GoLive will take care of that). Next, scroll down to the bottom of the page and add a new line just above the closing &lt;/body&gt; tag &#8211; see arrow in image&#8230;</p>
<p><img class="alignnone size-full wp-image-76" title="code_fixedend" src="http://www.mindpalette.com/wp-content/uploads/code_fixedend.gif" alt="code_fixedend" width="77" height="42" /></p>
<p>We need to add a closing &lt;/div&gt; tag just above the closing &lt;/body&gt; tag. There may (or may not) already be a &lt;/div&gt; tag just above the &lt;/body&gt; tag, but we need to add yet another one. So, we should end up with something like this:</p>
<p><img class="alignnone size-full wp-image-77" title="code_centerend" src="http://www.mindpalette.com/wp-content/uploads/code_centerend.gif" alt="code_centerend" width="94" height="53" /></p>
<p>Now we&#8217;re finished with source view! Switch back to layout view mode in GoLive and click the stair-step-looking icon at the top left to open the CSS editor:</p>
<p><img class="alignnone size-full wp-image-78" title="css_openeditor" src="http://www.mindpalette.com/wp-content/uploads/css_openeditor.gif" alt="css_openeditor" width="218" height="96" /></p>
<p>In the CSS editor, see if you already have a &lt;&gt; element (on the left) named &lt;body&gt;. If so, select that element to edit. If not, add a new CSS &lt;&gt; element (bottom left of css editor window) and name it body:</p>
<p><img class="alignnone size-full wp-image-79" title="css_addbody" src="http://www.mindpalette.com/wp-content/uploads/css_addbody.gif" alt="css_addbody" width="176" height="76" /></p>
<p>Select your new body style, select the alignment tag on the right and set the text alignment to &#8220;Center&#8221; as follows:</p>
<p><img class="alignnone size-full wp-image-80" title="css_bodyalign" src="http://www.mindpalette.com/wp-content/uploads/css_bodyalign.gif" alt="css_bodyalign" width="525" height="108" /></p>
<p>Now we&#8217;re almost done! We need to add a new ID (#) style and name it &#8220;wrapper&#8221; as follows:</p>
<p><img class="alignnone size-full wp-image-81" title="css_addwrapper" src="http://www.mindpalette.com/wp-content/uploads/css_addwrapper.gif" alt="css_addwrapper" width="158" height="59" /></p>
<p>For the style settings, set the text alignment however you want (usually left)&#8230;</p>
<p><img class="alignnone size-full wp-image-82" title="css_wrapperalign" src="http://www.mindpalette.com/wp-content/uploads/css_wrapperalign.gif" alt="css_wrapperalign" width="528" height="116" /></p>
<p>Set the left and right margins for your wrapper to &#8220;auto&#8221;&#8230;</p>
<p><img class="alignnone size-full wp-image-83" title="css_wrappermargin" src="http://www.mindpalette.com/wp-content/uploads/css_wrappermargin.gif" alt="css_wrappermargin" width="528" height="224" /></p>
<p>&#8230;and set the positioning to &#8220;relative&#8221;. Generally, set the height to &#8220;auto&#8221; and the width to a little larger than the total of the layout area you&#8217;ve already designed (in my example, it&#8217;s about 520 pixels). If you aren&#8217;t sure, you can either measure in GoLive or do a screen capture of your page in a browser and measure in another program:</p>
<p><img class="alignnone size-full wp-image-84" title="css_wrapperpos" src="http://www.mindpalette.com/wp-content/uploads/css_wrapperpos.gif" alt="css_wrapperpos" width="531" height="220" /></p>
<p>If all went well, your wrapper div should now center in the browser window. Keep in mind that the layout will still appear left aligned in GoLive CS&#8217;s layout view, so test/preview in your web browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindpalette.com/development/center-golive-layers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

