PDA

View Full Version : Is there anyway to...


shadey
10-27-2005, 04:05 PM
I've searched and can't find anything.

What I am wondering is....
Is there any way to change the way the subcategories are spaced after clicking on the category link. I'm sorry if this doesn't make sense.
My example is this:

On my main page there are two columns for the categories
{url not currently in service}

But when you click on one of them that has a lot of subcategories, it would look better if they were in three columns or at least spaced differently.
{url not currently in service}


Thanks if anyone can help.

David
10-27-2005, 04:15 PM
I believe it is outputting from this section of code in main.tpl
Content visible to registered users only.

I'm probably not good enough to write the statement, but it would say something like:
IF category is not equal to zero, add add 1 to $cats_per_column

shadey
10-28-2005, 03:55 AM
Thanks David, I have no clue how to do that :(

shadey
10-28-2005, 01:36 PM
If someone could help me with this I would be happy to make
a small paypal donation.

David
10-28-2005, 02:37 PM
I've got someone looking at it.

David
10-28-2005, 03:59 PM
Here is one method that would work:

Content visible to registered users only.

There may be a more elegant smarty solution, but this one works.
It says if the category is NOT 1 (where you list your states), then act normally, otherwise use 3 columns.

shadey
10-28-2005, 05:07 PM
Wow awesome!

Tim_Myth
10-28-2005, 05:09 PM
You would have to change the code to something like this:

Content visible to registered users only.

WARNING!
This has not been tested. Nor do I know it works. I'm not a php coder! :D

How it works (I think):
$smarty.foreach.categs.iteration is a counter. If we mod by 15 and it is not the first categs in the list, a new td wil be printed when the mod result is 0. This should result in 15 categories per column.

COULD SOMEONE MUCH SMARTER THAN ME CONFIRM THIS? :D

Tim_Myth
10-28-2005, 05:11 PM
Sorry about the cross post. I'm at work and it took me a while to formulate a response. :oops:

shadey
10-28-2005, 05:12 PM
I just tried David's and it did not work......

David
10-28-2005, 05:21 PM
Let me know how Tim's mod worked. I'm still looking when I free time.

David
10-28-2005, 05:33 PM
Content visible to registered users only.

Content visible to registered users only.

Looking at those two peices of code, I know there is an answer.

Tim_Myth
10-28-2005, 05:33 PM
Oops! I forgot to modify the line that puts the closing td on the page too. :(

{if ($smarty.foreach.categs.iteration mod 10 eq 0 and $smarty.foreach.categs.iteration gt 1) or $smarty.foreach.categs.last}</td>{/if}


This line has to be modified to make your table work right.

shadey
10-28-2005, 05:44 PM
Tim,

I can't figure out where to put the code for sure. HELP!!!!

Thanks!

David
10-28-2005, 06:59 PM
This is in main.tpl starting around line 34. You should be able to simply replace that section in your main.tpl file. Are you understanding?

shadey
10-28-2005, 07:05 PM
David,

I do understand, but didn't understand where to add the last part of code Tim added in the next post :)

Thanks!

Tim_Myth
10-28-2005, 07:30 PM
Ok, I started testing the code, and here's something that works:

Content visible to registered users only.

This should be placed in your main.tpl file. Unless you've modified the directory a bunch, you should be able to simply replace the entire table generation portion of the file.

This will set it up so each column has 10 categories. This will get quite crowded if you have 50 or 60 categories, so set the number accordingly! You can change the number of categories per column in the last if statement. For example, this will give you 20 categories per column:
Content visible to registered users only.
Needless to say, if you have fewer than 10 categories, only one column will be displayed.

You can see it in action at my test directory http://www.ndthunder.com.

Tim_Myth
10-28-2005, 07:33 PM
LOL! Actually, I kinda like this mod. :) I think I will have to use it in a template.

shadey
10-28-2005, 08:09 PM
Doesn't work right for me

{url not currently in service}

Wait, tried it copying exact .... works, but all my categories on the main page are single file.

shadey
10-28-2005, 08:20 PM
Me again.

I don't know if I am just doing something wrong, or what.

I got it to work sort of. However, what I was hoping to do, is on the main page of categories have 2 columns, then when you click that and go to say High Schools (there are 52 categories there), I wanted that to show 3 columns.

What i get is on the main template, two columns but not evened out. Then 4 columns on the next page (when clicking the High School on main page).

I'm sorry to be so confusing......

Tim_Myth
10-28-2005, 08:24 PM
I think I'm missing something...namely the big picture. :D

When I look at your directory, I see two columns of categories on your main page. Some have subcategories, and some don't. Since each column has at most 10 categories, I can see that my code snippet is doing what I made it do. I'm not entirely sure that what I made it do is what you were wanting though. Can you maybe explain again what you're looking for? Maybe tell me what the difference between what you want and what I've made is?

Tim_Myth
10-28-2005, 08:26 PM
(Darn cross posts...)


Aha! I think I'm understanding now!

shadey
10-28-2005, 08:49 PM
Thanks.

I put it back to the other way for now.

So basically what I want is

.../index.php page to have 2 columns (fairly equal) for 14 categories

Then when clicking category High School have that have 3 columns for 52 categories.....

David
10-28-2005, 08:52 PM
It sounds like you can play with the number and get different results. I'll do some testing on Tim_Myth's much appreciated help.

David
10-28-2005, 08:58 PM
Yes, by changing the number found at "mod 10" it changes the number of categories to display before starting a new column. If you look at http://www.directhoo.com/ you will see that it displays 7 categories per column.

shadey
10-28-2005, 09:07 PM
Thanks for all the help on this.

Do you think there is a way to display on the main page
7 categories per column.

But on the High School category show 15 categories per column?

shadey
10-28-2005, 09:34 PM
I found this post, I tried it and it works.
{url not currently in service}
However, when you go back to the main page the whole url shows this http://amateurwrestlinglinks.com/%7Bif%20$smarty.const.ENABLE_REWRITE%7D%7B$cat.TIT LE_URL%7D/%7Belse%7Dindex.php?c=%7B$cat.ID%7D%7B/if%7D

And then it just stays on the main page.

David
10-28-2005, 09:43 PM
Content visible to registered users only.

Yes, we just need another {if} statement. Eventually, we'll get the answer. Unfortunately, I'm not "good" enough to come up with the exact syntax, though I think it is probably a fairly simple answer.

Tim_Myth
10-28-2005, 10:09 PM
Content visible to registered users only.

I'm sure this could be done better, but here is exactly what you requested. :)

If you vary the number on line 6, it will set the maximum number of categories put in a column before switching to a 3 column layout.

This means that for a category with less than 40 subcats, it will use a two-column layout. More than 40 subcats will use three column.

This should go in your main.tpl.

Tim_Myth
10-28-2005, 10:11 PM
This is of course installed on that same test directory. View it at http://www.ndthunder.com.

shadey
10-28-2005, 10:34 PM
Tim

THANK YOU THANK YOU THANK YOU....!!!!