<?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>My Quick Fix &#187; Joomla!</title>
	<atom:link href="http://myquickfix.co.uk/category/computers/web-development/joomla/feed/" rel="self" type="application/rss+xml" />
	<link>http://myquickfix.co.uk</link>
	<description>Quick fixes for little problems...</description>
	<lastBuildDate>Sat, 04 Feb 2012 16:11:06 +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>Moving VirtueMart: Link path problem in admin console</title>
		<link>http://myquickfix.co.uk/2009/01/moving-virtuemart-link-path-problem-in-admin-console/</link>
		<comments>http://myquickfix.co.uk/2009/01/moving-virtuemart-link-path-problem-in-admin-console/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 10:52:55 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Joomla!]]></category>

		<guid isPermaLink="false">http://myquickfix.co.uk/?p=101</guid>
		<description><![CDATA[Problem: Just now, I needed to move a website running Joomla 1.5 and VirtueMart 1.1.2 from the development server, to the live web space. After I had moved the data, and the files, and updated the path in Joomla&#8217;s &#8216;configuration.php&#8217; file, it seemed to work ok, but all the links in the VirtueMart Admin area still [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong> Just now, I needed to move a website running Joomla 1.5 and VirtueMart 1.1.2 from the development server, to the live web space. After I had moved the data, and the files, and updated the path in Joomla&#8217;s &#8216;configuration.php&#8217; file, it seemed to work ok, but all the links in the VirtueMart Admin area still pointed to my development server.</p>
<p><strong>Fix:</strong> After doing a &#8216;find in files&#8217; for my development server&#8217;s name, I found two more paths that need changing in VirtueMart&#8217;s own configuration file. This is the file:</p>
<blockquote><p>/administrator/components/com_virtuemart/virtuemart.cfg.php</p></blockquote>
<p>The following two paths need editing to point to the new server location (URL):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>35
36
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'URL'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://my.devserver.com/joomla/'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SECUREURL'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'https://secure.devserver.com/joomla/'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>A simple fix, but probably worth posting.</p>
]]></content:encoded>
			<wfw:commentRss>http://myquickfix.co.uk/2009/01/moving-virtuemart-link-path-problem-in-admin-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select template by Section in Joomla 1.5</title>
		<link>http://myquickfix.co.uk/2009/01/select-template-by-section-in-joomla-1-5/</link>
		<comments>http://myquickfix.co.uk/2009/01/select-template-by-section-in-joomla-1-5/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 12:32:41 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Joomla!]]></category>

		<guid isPermaLink="false">http://myquickfix.co.uk/?p=103</guid>
		<description><![CDATA[Problem: In Joomla 1.5, at present, there is no way to set the template applied to an article or category  based on the section that article is in. Templates can be set by menu item, but not by the overall section they reside in. This means that if multiple templates are being used, each time a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong> In Joomla 1.5, at present, there is no way to set the template applied to an article or category  based on the section that article is in. Templates can be set by menu item, but not by the overall section they reside in. This means that if multiple templates are being used, each time a new article is added, changes have to be made to the template setup too &#8211; very tedious. All I wanted was to be able to create an article or category, add it to a certain section, and know that it would be rendered/displayed using a particular template:</p>
<p><strong>Fix:</strong> This took some searching and tweaking. I found a post in the Joomla developers forum about someone trying to do something similar, but their example code was broken. It was enough to get me started though.</p>
<p>What you need to do is: find and open application.php in the includes directory on the root of your Joomla 1.5 installation. Then find line 309 or thereabouts and look for this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>309
310
311
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Allows for overriding the active template from the request</span>
<span style="color: #000088;">$template</span> <span style="color: #339933;">=</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getCmd</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$template</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$template</span> <span style="color: #339933;">=</span> JFilterInput<span style="color: #339933;">::</span><span style="color: #004000;">clean</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$template</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'cmd'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// need to filter the default value as well</span></pre></td></tr></table></div>

<p>Insert <strong>AFTER</strong> the comment on line 309, but <strong>BEFORE</strong> line 310, add this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Templates by Section hack - Begin</span>
&nbsp;
<span style="color: #000088;">$eItemView</span> <span style="color: #339933;">=</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getVar</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'view'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$eItemId</span> <span style="color: #339933;">=</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getVar</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$sectionId</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$eItemId</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$eItemId</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>? <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$eItemId</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$eItemId</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$eItemId</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$eItemView</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;article&quot;</span><span style="color: #339933;">:</span>
<span style="color: #000088;">$edb</span> <span style="color: #339933;">=&amp;</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDBO</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$eQuery</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT sectionid FROM #__content WHERE id LIKE '</span><span style="color: #339933;">.</span><span style="color: #000088;">$eItemId</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$edb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$eQuery</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sectionId</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$edb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadResult</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;category&quot;</span><span style="color: #339933;">:</span>
<span style="color: #000088;">$edb</span> <span style="color: #339933;">=&amp;</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDBO</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$eQuery</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT section FROM #__categories WHERE id LIKE '</span><span style="color: #339933;">.</span><span style="color: #000088;">$eItemId</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$edb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$eQuery</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sectionId</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$edb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadResult</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;section&quot;</span><span style="color: #339933;">:</span>
<span style="color: #000088;">$sectionId</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$eItemId</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Edit the section id below, you can find it in the sections admin area.</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$sectionId</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$template</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;rhuk_milkyway_red&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Use the full template name.</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// Add more if clauses if there are other templates.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Templates by Section hack - End</span></pre></div></div>

<p>Hopefully you can see what this does. It looks for the section id to use in 3 ways, depending on whether joomla is currently displaying a section root page, a category root page, or an article. It then looks to see whether that section id has had a specific template specified for it by name.</p>
<p>This hack works well for me, I only need to add the different template data once in application.php for a given site. Ideally someone needs to make an admin mod for this, so that sections and categories can be assigned different templates in the backend. Maybe one day I&#8217;ll make one, but not unless there&#8217;s demand <img src='http://myquickfix.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Any questions, corrections or thoughts, please comment below (no need to create an account or anything!)</p>
]]></content:encoded>
			<wfw:commentRss>http://myquickfix.co.uk/2009/01/select-template-by-section-in-joomla-1-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

