Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

URL Trouble

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-12-2003, 02:42 PM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default URL Trouble

I have been messing with this problem on and off for a good day now, here's the deal.

The following code is used in my categories.tpl file to display each category

Code:
{section name=cat_num loop=$categories} <tr> <td class=VertMenuItems><font class=CategoriesList>•{$categories[cat_num].category|escape|wordwrap:23:" \n"}</font> </td> </tr> {/section}

The problem is that when the category title extends to a second line (because it exceeds 23 characters) the link does not carry the categoryid number in the URL.

Here are two examples or typical links...

Working URL Example (top line):
http://www.thewebsite.com/store/customer/home.php?cat=328&XCARTSESSID=6dea0fbfecc8864014e6f b291cf8df0a

Non-Working URL Example (bottom line):
http://www.thewebsite.com/store/customer/home.php?cat=.categoryid&XCARTSESSID=6dea0fbfecc88 64014e6fb291cf8df0a

Thanks in advance to anyone who can solve this. I am drawing a blank.
Reply With Quote
  #2  
Old 03-12-2003, 10:34 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Cant you just change this to:

Code:
{section name=cat_num loop=$categories} <tr> <td class=VertMenuItems><font class=CategoriesList>•<a href="home.php?cat={ $categories[cat_num].categoryid }">{$categories[cat_num].category|escape|wordwrap:23:" \n"}</a></font> </td> </tr> {/section}
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 03-13-2003, 05:19 AM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default FD Suggestion

Hi FD,

Yeah I had that, but the problem is that the underline that designates the link is then underlining the \n. I don't want to add the "text decoration: none" to the CSS so I am left with trying to figure out how to 'restart' the link.

According to smarty.php.net it says I should simply leave off the smarty designators {}, but as you can see, no luck.

It's weird the '$categories[cat_num].categoryid' is being interpretted, but I can't figure out how. See how in non-working link the '$categories[cat_num]' doesn't show up, but the .categoryid does? Maybe I need some quotes or something?

Thanks for the suggestion. Any others? You think Boomer might know?
Reply With Quote
  #4  
Old 03-13-2003, 05:41 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

How about putting in {assign var="temp" value=$categories[cat_num].categoryid} before this and using $ as the href

<a href="home.php?cat={$temp}">
__________________
ex x-cart guru
Reply With Quote
  #5  
Old 03-13-2003, 06:23 AM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default

No can do, because it puts two smarty tags - {$temp} - inside of two other smarty tags. I tried leaving them off, but then the value simply doesn't show up. I also tried the {ldelim} and {rdelim} tags, but that too did not work.

Fun heh?

There has to be a way, and I am betting it is simple. I just don't see it, yet.

Thanks again. I definitely welcome more input.
Reply With Quote
  #6  
Old 03-13-2003, 06:38 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Sorry I didn't make myself clear, try this:

Code:
{section name=cat_num loop=$categories} {assign var="temp" value=$categories[cat_num].categoryid} <tr> <td class=VertMenuItems><font class=CategoriesList>•{$categories[cat_num].category|escape|wordwrap:23:" \n"}</font> </td> </tr> {/section}
__________________
ex x-cart guru
Reply With Quote
  #7  
Old 03-13-2003, 06:48 AM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default

Doh...

Here's what I get when I add in the code...

Parse error: parse error in /home/thewebsite/public_html/store/templates_c/%%-12/%%-1253885908/categories.tpl.php on line 50
Reply With Quote
  #8  
Old 03-13-2003, 08:32 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

I've just used that code and it worked fine for me. Are there any other problems in the templates that you changed.
__________________
ex x-cart guru
Reply With Quote
  #9  
Old 03-13-2003, 09:08 AM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default

Hmm... I defaulted back to the original categories.tpl and it worked. I'll mess with it a bit and let you know the success story.

Excellent code, I must admit I did think about assigning a temporary variable like you did, but was too stubborn to implment it. Great work FD! If you ever run for office, let me know.
Reply With Quote
  #10  
Old 03-13-2003, 09:26 AM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default

Got it now, works perfectly. Thanks again.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:52 AM.

   

 
X-Cart forums © 2001-2020