Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-05-27 10:57:48

otti
Member
From: Australia
Registered: 2008-04-16
Posts: 75
Website

Article/Section for every logo?

On of the sites I’m creating with Textpattern requires a dropdown menu inside two single pages where the user can select manufacturers.
You can see the test page here (I have created so far only the top selection “Bifold”):
http://207.57.112.80/by-manufacturer
On selection (Javascript select-on-go menu) I direct to a different section/article which will display the logo and possibly some text alongside the logo. Now, I have got over 40 logos to show. Is there any other way instead of creating a section and an article for every manufacturer? I tried with categories but I still need a section and an article for every manufacturer, I believe. any suggestions to point me in the right direction?

Many thanks
otti

Last edited by otti (2009-05-27 10:58:52)

Offline

#2 2009-05-27 19:00:23

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Article/Section for every logo?

otti wrote:

I tried with categories but I still need a section and an article for every manufacturer, I believe.

I don’t think so. If you create all manufacturers as article categories, and exactly the same categories for images, you can use <txp:category title="1" /> to display the product name, some image plugin to display the image in that category (wet_for_each_image can display one or more images from the current category), and nothing more than an article tag to list the products. Wrap all of this in <txp:if_category> tags, and you’ll have category pages (/products/?c=bifold) to display your products.

Offline

#3 2009-05-28 02:03:31

otti
Member
From: Australia
Registered: 2008-04-16
Posts: 75
Website

Re: Article/Section for every logo?

Hi Els,

Thanks for the reply. I tried your suggestion but have problems to assign the different categories, without creating separate articles. Here is what I’ve got:
The article “by-manufaturer” contains some text and the Javascript form as such:
<code>
<form action=“gotoLocation.cgi”>
<p><select id=“newLocation”>
<option selected=“selected”>— Select a Manufacturer —</option>
<option value=“by-manufacturer”>Bifold</option>
<option value=“man-bosch-rexroth”>Bosch/Rexroth</option>

</select></p>
</form>
</code>

In the same form (below the Javascript) I have the following now:
<code>
<txp:if_category name=“Man Bifold”>
<txp:category title=“1” />
<txp:wet_for_each_image category=“Man Bifold”>
<txp:thumbnail id=”{3}” />
</txp:wet_for_each_image>
</txp:if_category>
</code>

The manufacturer article has a different category assigned to. So how to I get the category “Man Bifold” (and all the other ones) assigned to that same article without creating new articles?

Thanks very much again
otti

Last edited by otti (2009-05-28 02:40:53)

Offline

#4 2009-05-28 03:33:17

otti
Member
From: Australia
Registered: 2008-04-16
Posts: 75
Website

Re: Article/Section for every logo?

I figured now that I have to point the option value of my Javascript to the category name
<code>
<form action=“gotoLocation.cgi”>
<p><select id=“newLocation”>
<option selected=“selected”>— Select a Manufacturer —</option>
<option value=“?c=manBifold”>Bifold</option>

</select></p>
</form>
</code>

And also re-named the category to start with lowercase and without spaces.

<code>
<txp:if_category name=“manBifold”>
<p>Test text</p>
<txp:category title=“1” />
<txp:wet_for_each_image category=“manBifold”>
<txp:thumbnail id=”{3}” />
</txp:wet_for_each_image>
</txp:if_category>
</code>

I left some test text in there but the category name is not displayed as yet. Nor is the image. What am I still doing wrong?

Cheers
otti

Offline

#5 2009-05-28 23:59:59

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Article/Section for every logo?

otti wrote:

And also re-named the category to start with lowercase and without spaces.

Don’t use capitals at all in category (and section) names.

I figured now that I have to point the option value of my Javascript to the category name

You can make that code dynamic:

<form action="gotoLocation.cgi">
	<p><select id="newLocation">
		<option selected="selected">— Select a Manufacturer —</option>
		<txp:category_list break="">
			<option value="/products/?c=<txp:category />"><txp:category title="1" /></option>
		</txp:category_list>
	</select></p>
</form>

Don’t put the following code inside your article, but on the page:

<txp:if_category>
	<p>Test text</p>
	<txp:category title="1" />
	<txp:wet_for_each_image category='<txp:category />'>
		<txp:thumbnail id="{id}" />
	</txp:wet_for_each_image>
	<txp:article /><!-- to display the manufacturer's products -->
</txp:if_category>

Edit: I just noticed that you put the code inside an article. I adapted my code examples because the way it was it wouldn’t work inside an article. If you want to display your product (article) list in the ‘products’ section, your category links need to point to /products/?c=category-name. Or you can use value="/category/<txp:category />" to point to /category/category-name, depending on your intention. The way you had it made them point to /article-title/?c=category-name, and that would never work.

Last edited by els (2009-05-29 00:19:06)

Offline

#6 2009-05-29 00:44:12

otti
Member
From: Australia
Registered: 2008-04-16
Posts: 75
Website

Re: Article/Section for every logo?

Hi Els,

Yes, I have figured it out in the meantime, but obviously in a much harder way than your version.
I have tried your suggestion with the category list, but then I get all article categories listed (i have more article categories than the ones used for the manufacturers. Unless there is a way to specify which article categories not to use?

Since I did not get the wet_for_each_image plugin to work (now I know why after reading your explanation), I have used the image tag. I also had to include the ability for my client to add some text accompanying the logos (i.e. see Litre Meter) and used the artcile_custom tag for that. Here is an excerpt of how one selection looks like:
<code>
<txp:if_category name=“man-bifold”>
<br />
<div class=“rule”>
</div>
<h3><txp:category title=“1” /></h3>
<p><txp:image id=“3”>
</txp:image></p>
<txp:article_custom category=“man-bifold”>
<txp:body />
</txp:article_custom>
</txp:if_category>
</code>

Nay “objections”? It was pretty time consuming since i did not create them all dynamically, but it worked. The same, by the way, for the the next page “By-Category”.

Thanks very much again.
Without the forums help I would have been really stuck.

otti

Offline

#7 2009-05-29 15:42:06

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Article/Section for every logo?

otti wrote:

Unless there is a way to specify which article categories not to use?

Use the categories or exclude attribute in <txp:category_list> :)

Offline

#8 2009-05-30 01:49:39

otti
Member
From: Australia
Registered: 2008-04-16
Posts: 75
Website

Re: Article/Section for every logo?

Perfect. Thanks again.
otti

Offline

Board footer

Powered by FluxBB