Hiding Menus when items are not present

alt=
Luis456
@luis456
8 years ago
48 posts
Hello!

I created a custom page for the artist profile artist with different sections and menus included on one page.
So far it is working as expected. The problem that I have now is, if the artist does not has an event, audio, video uploaded the menu and block still display with empty items.

Is there a way to auto hide the menu and block if the items are not present or upload by the user?
Similar to the profile menu when modules are not active.

For example if the artist does not have a audio uploaded, I would the menu and block not to appear in the page.
I have tried adding the conditional statement before the menu title and block display, but it hides all including the users that have videos.
I tried to look at the code in the profile_menu.tpl, but I don't see anything that can help me.
updated by @luis456: 07/09/16 12:33:04AM
michael
@michael
8 years ago
7,744 posts
What code are you using, how are you making the custom page?

The normal modules will show the profile menu tab to the owner so they can create the items but not show it to any visitors if there are no items created yet.

Not sure how you're doing it so its hard to advise on what to do.
alt=
Luis456
@luis456
8 years ago
48 posts
Hello .. Michael and thank you for your email!
To illustrate better, see the attached image.
The top picture image displays a profile from an artist that has the latest videos(uploaded, you tube and vimeo), Music(uploaded, I cloud), latest events, blogs and pictures.
The second artist profile does not have much uploaded or embedded yet, but the menu and block section still shows.
All I'm looking to accomplish is that to use a condition if(items present for that profile.. do show it. Other wise hide it)
Again this is for the public view.

Does it makes sense?
foto.jpg
foto.jpg  •  196KB

foto1.jpg
foto1.jpg  •  195KB


updated by @luis456: 03/28/16 06:51:55AM
michael
@michael
8 years ago
7,744 posts
Looks like that's in your skins profile_index.tpl page.

Seams like you're asking how to check that there is anything in the list created by jrCore_list before displaying the section.

Makes me guess you're probably doing something like this:
<h1>Photos</h1>
{jrCore_list module="jrGallery" profile_id=$profile_id}
So even if there are no photos, the photos heading is being displayed.

An easy way to change it would be to move the heading into the template that controls the photos so it only gets output if there are photos returned. Something like:

{jrCore_list module="jrGallery" profile_id=$profile_id template="profile_photos_row.tpl"}
and in
/skins/(YOUR SKIN)/profile_photos_row.tpl

copy the default item_list from the photos module to profile_photos_row.tpl then put your heading in there.

There are many ways to do it but that seams like one way that would work. Another would be to check using {debug} to see if there are any ?????_count items in the location where you're using {jrCore_list} and if there are, wrap the whole section in an IF block

Docs: "{debug}"
https://www.jamroom.net/the-jamroom-network/documentation/development/1477/debug

Docs: "{jrCore_list}"
https://www.jamroom.net/the-jamroom-network/documentation/development/89/jrcore-list

Docs: "Template Blocks"
https://www.jamroom.net/the-jamroom-network/documentation/development/3126/template-blocks
gary.moncrieff
gary.moncrieff
@garymoncrieff
8 years ago
865 posts
I went through the same some months ago and can agree the easiest way is to mover everything into the included file, and just have the actual template call in the profile_index page.

Tags