X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   URL Trouble (https://forum.x-cart.com/showthread.php?t=1851)

machnhed1 03-12-2003 02:42 PM

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. :(

funkydunk 03-12-2003 10:34 PM

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}


machnhed1 03-13-2003 05:19 AM

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? :?:

funkydunk 03-13-2003 05:41 AM

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}">

machnhed1 03-13-2003 06:23 AM

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? :D

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.

funkydunk 03-13-2003 06:38 AM

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}


machnhed1 03-13-2003 06:48 AM

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

funkydunk 03-13-2003 08:32 AM

I've just used that code and it worked fine for me. Are there any other problems in the templates that you changed.

machnhed1 03-13-2003 09:08 AM

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. :D

machnhed1 03-13-2003 09:26 AM

Got it now, works perfectly. Thanks again.


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

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.