SimplePortal

Customization => Blocks and Modifications => Mod Requests => Topic started by: guiller_mote on June 27, 2018, 07:48:02 AM

Title: To be able to choose if a block is displayed only for mobile
Post by: guiller_mote on June 27, 2018, 07:48:02 AM
Hi all, I hope some body can hel me.

Is there any posibility to choose if a block is displayed only for mobile or desktop? I know I saw that in some other portal, I don't remember sorry, but I believe it is a very good functionality.
Some body can tell me if there is any mod for this?

Thanks in advanced.

Regards.
Title: Re: To be able to choose if a block is displayed only for mobile
Post by: ♦ Ninja ZX-10RR ♦ on June 27, 2018, 08:06:42 AM
Hello, have a look at this: https://simpleportal.net/index.php?topic=13954.msg69201#msg69201 :)
Title: Re: To be able to choose if a block is displayed only for mobile
Post by: guiller_mote on June 28, 2018, 11:29:32 AM
Thanks so much for your quick answer. I will try to implement that but probably I will back to you because I am not an expert, sorry :(
Title: Re: To be able to choose if a block is displayed only for mobile
Post by: guiller_mote on June 29, 2018, 02:34:43 PM
I knew I would have to back :(.
I don't know how to put the code:

Code: [Select]
#sp_block_ID
{ display: none;}
@media only screen and (max-width: 750px), only screen and (min-resolution: 300dpi) {

#sp_block_X {
css properties here;
}
}
I suppose is in default/css/portal.css but how I know the ID of the block? what I have to put in css properties?
Title: Re: To be able to choose if a block is displayed only for mobile
Post by: guiller_mote on July 30, 2018, 04:19:10 PM
Can anybody help me on how use that code exactly?
Title: Re: To be able to choose if a block is displayed only for mobile
Post by: ♦ Ninja ZX-10RR ♦ on July 30, 2018, 09:46:41 PM
You can see the ID of the block whenever you edit it, in the URL.
The code has to be added in /whateverthemefolderyouareusing/css/index.css at the end of the file.

And sorry for the delay I completely forgot :/
Title: Re: To be able to choose if a block is displayed only for mobile
Post by: guiller_mote on July 31, 2018, 02:19:30 PM
Don't worry Ninja, thanks for your answer.
I could do it adding the code in /themes/default/css/portal.css.
I added at the end the folowing code:
Code: [Select]
#sp_block_ID
{ display: none;}
@media only screen and (max-width: 750px), only screen and (min-resolution: 300dpi) {

#sp_block_1 {
display: none;
}
}
And the block 1 disapear but only the body, the title still continue showing. There is some css code tu remove it and don't show any part of the box?
In the most cases it works for me as I wanted to remove some publicity blocks that I have them without title but with this functionality now I wolud like to remove also some standard blocks like statistics or so :)

Thanks again for your help.
Title: Re: To be able to choose if a block is displayed only for mobile
Post by: guiller_mote on August 30, 2018, 01:51:14 PM

And the block 1 disapear but only the body, the title still continue showing. There is some css code tu remove it and don't show any part of the box?
In the most cases it works for me as I wanted to remove some publicity blocks that I have them without title but with this functionality now I wolud like to remove also some standard blocks like statistics or so :)

Thanks again for your help.

Some body could help me with this? I would like to hide some blocks that I have with title and I don't be able to hide it too.

Thanks.
Title: Re: To be able to choose if a block is displayed only for mobile
Post by: Chen Zhen on September 02, 2018, 01:22:59 PM
You have a few options.
If it is only HTML or PHP blocks you are concerned about then you can set the block settings to no body & no title then use something like this:
HTML example:
Code: [Select]
<div class="cat_bar">
<h3 class="catbg">
BLOCK TITLE GOES HERE
</h3>
</div>
<div class="windowbg">
BLOCK BODY GOES HERE
</div>

Otherwise perhaps you will have to surround the entire block coding with your HTML condition in ./Themes/default/Portal.template.php
Look at the template_block_default template & echo your condition at the start of the function & close the condition tag at the end of the function.

Portal pages use a different template located in ./Themes/default/PortalPages.template.php
You will have to apply the same sort of thing in that file for pages.
SimplePortal 2.3.8 © 2008-2024, SimplePortal