News: When asking for support, it helps us and you, if you read the Posting Guidelines

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

June 27, 2019, 12:28:17 AM

Login with username, password and session length

Recent

Members
Stats
  • Total Posts: 188461
  • Total Topics: 20729
  • Online Today: 22
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 16
Total: 16

Author Topic: Request - select all articles in a category  (Read 5631 times)

0 Members and 1 Guest are viewing this topic.

Offline fallen

  • Jr. Member
  • **
  • Posts: 6
Request - select all articles in a category
« on: April 23, 2013, 03:41:54 PM »
Hello!
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

Offline lurkalot

  • Administrator
  • *
  • Posts: 6055
    • Camera Craniums
Re: Request - select all articles in a category
« Reply #1 on: April 24, 2013, 01:01:30 AM »
Hi fallen, and welcome to tinyportal.net

You mean something like this, on my site? http://cameracraniums.com/forum/index.php?page=articles

If so have a look here http://www.tinyportal.net/index.php?topic=33208.0  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.

Offline fallen

  • Jr. Member
  • **
  • Posts: 6
Re: Request - select all articles in a category
« Reply #2 on: April 24, 2013, 03:15:01 AM »
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:
January
February
March
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.