Passing category dynamism to an xml template
Posted: 29 March 2006 02:55 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  756
Joined  03-22-2004

K this probably has a very simple ‘no’ answer and I wasted an incredible amount of hours on it but here goes.

I have 2 templates.
Template 1  is a category template with flash embedded in it for a gallery.
Template 2  is an XML template that lists categories and images from the gallery module. This is called from the flash file in the embed code itself.

There are multiple categories for the gallery. So when I load Template 1 I have a URL ending in C#  e.g.(...gallery/C8/)
My XML contains a query

{exp:query sql="SELECT cat_id,cat_folder FROM exp_gallery_categories WHERE gallery_id = '1' AND parent_id = '9'"}

Now so, this is all fine if I want to list all the subcategories of the parent category which has the id of ‘9’ which you can see in my query there.
BUT I want that ‘9’ to reflect my C# on the category page so the XML loads the correct data for the category page it is on.

Any suggestions for passing that variable at page load time to the xml?

Profile
 
 
Posted: 29 March 2006 08:57 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23485
Joined  05-20-2002

You could use php to strip off the first character:

<?php
$cat_id
= '{segment_3}';
$cat_id = substr($cat_id, 1);
?>

Then echo it back in your query- php parsed on input.

And it might be possible to use a category heading tag- though I’m a little fuzzy on exactly what you’re doing.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 29 March 2006 09:30 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  756
Joined  03-22-2004

In my gallery I have Main Categories and Sub Categories
Pictures are only going to be added to the sub categories

I am using SlideShowPro to view this gallery.

On my gallery category page I have the flash file embedded.
I also have a drop-down menu with a list of the main categories so when you click one you goto another main category page. On these pages I want the sub categories loaded into the flash gallery.

I can do all this except pass the cat_id or segment_3 of the current Main Category page into the xml file template I use to list my subcategory entries.

So the code you provided is fine and it supplies me with the category id I need. But it is no good to me on the gallery template. I want it to be passed to the xml template and plonked into the query you can see above to replace the ‘9’

Hope that makes more sense. I can PM you the templates if you have the time, Thanks again

Profile
 
 
Posted: 30 March 2006 08:19 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  756
Joined  03-22-2004

Woohoo I have succeeded in achieving this.

On my gallery category page I passed the {segment_3} through the flash embed code using

http://www.mysite.ie/index.php/gallery/images/?album_id={segment_3}

then in my XML I called this id using

$cat_id =  $_REQUEST['album_id'];

I did turn my XML template into a php template and generated the XML in that.

Thanks for your help. When I have the site live I can direct you to it and this post might make sense to people

Profile
 
 
Posted: 06 August 2006 03:02 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
RankRank
Total Posts:  138
Joined  04-13-2006

Hello there - would you be able to post some of your sample code as I am looking to do something like this and am slightly confused by your extracting the segment_3 variable from the flash embed code - do you add it as a query string onto the end of the .swf part ie something.swf?album_id={segment_3}
?

Thank you!

Profile
 
 
Posted: 07 August 2006 02:14 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  756
Joined  03-22-2004

This tutorial I wrote might expand a bit more as the method gathered speed after that this thread.

If that still does not achieve your goals then post back with some more specifics

Profile
 
 
Posted: 30 June 2008 12:07 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
RankRank
Total Posts:  185
Joined  11-27-2003

Just want to say thank you for the tutorial. It works great as what I need it.

Profile
 
 
   
 
 
‹‹ Login Template      Truncating the body text ››
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64535 Total Logged-in Users: 22
Total Topics: 81114 Total Anonymous Users: 15
Total Replies: 436444 Total Guests: 195
Total Posts: 517558    
Members ( View Memberlist )
Newest Members:  marlusbluespotmusicvolandspinhirnetheminiokostiamasterjeMBossbchaleyalvonsius