HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media


Welcome to TinyPortal. Please login or sign up.

September 21, 2023, 10:58:19 PM

Login with username, password and session length
  • Total Posts: 194,531
  • Total Topics: 21,180
  • Online today: 97
  • Online ever: 3,540
  • (September 03, 2022, 01:38:54 AM)
Users Online
Users: 0
Guests: 103
Total: 103

Request - select all articles in a category

Started by fallen, April 23, 2013, 10:41:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


First of all sorry if I make any mistake, I'm Italian so English is not my mother tongue. And I know I could post in the Italian section but international support is more complete I guess :)
And sorry if this was already discussed, I tried to search and found nothing.

So this is the thing. I've been using wordpress+smf but I recently migrated to smf+tinyportal in order to have everything alltogether.
In my website I have got some categories and subcategories with many articles.
I want to make a menu which shows all the articles in a category or subcategory whenever someone is visiting it or any of the articles in it.
I could manually populate a menu, but since I've got tons of articles this is frustrating.
The perfect solution would be an automatic menu block which grabs all the categories but I didn't seem to find one.
So I found this solution:
I can manually create a menu with categories and subcategories. Then I create another block with type "Articles in a categories".
I select the category in which this block should appear.
Now the problem is that this block only shows when I open the category. I also want it to show when visiting any article belonging to that category. Is there a way to automatically select all articles in a category during the creation of the block?
Or a modification which would automatically make a block appear in all pages belonging to the category selected and not only in the category page itself?
I hope I've been clear.
Thank you

Link to my site: mantainance mode so it's useless
SMF version: 2.0.4
TP version: 1.0


Hi fallen, and welcome to

You mean something like this, on my site?

If so have a look here  Use the third code shown for your version of SMF (SMF2 & TP1) and this will need to go in a php article, and use this as your article index page. Then just link to that page instead of your menu.

Hope this helps.


Thank you for your answer.
That mod is cool and I will probrably use it, but it doesn't solve the problem.
To make things clear, I will do this example.
Suppose I have a blog with tinyportal.
I have these categories:
I have a right block menu with:
- January
- February
- March

January has got Post 1, Post 2, Post 3 in it.
If i set a new block with type "articles in a categories" and select the option to show it only in the category "January", then, when I click on "January", that block will appear under the menu block, showing another kind of submenu with
- Post 1
- Post 2
- Post 3
In it.
And this is fine.
But that works until i stay in the category page, which means until I stay on the generic "January" page.
If I click "Post 2" for example, that kind of sub-menu disappears.
In order to keep it visible also when visiting any of the posts in the January category, I have to modify the sub-menu block and select its visibilty not only for the category "January", but also by checking every single article in that category. In this way the submenu will stay visible also when visiting Post 1, Post 2, Post 3. But I have a lot of posts and it should be something automatic for every new post in that category.
So I was wondering if there was a way to check or select all the articles that belong to a category selected in the visibility option of the block.
Or even better, if there was a way to make things work differently with a php mod.
I mean, right now it should work this way. Let's suppose the cat January is 29.

if cat = 29
then show "articles in a category block"

I want it to be
if cat = 29 OR article->getcategory()=29
then show "articles in a category block"

I hope it's more clear this way.
If you may suggest me which php file(s) should be modified and which part(s), I may try to look by myself and maybe I can work something out.