Is there a way?

Started by Fog, January 12, 2015, 02:06:47 AM

Previous topic - Next topic

Fog

You can add html to your description when creating a board.

In some cases I use an image in this field.

But I have some members that don't want to view those images.

Is there a way to collapse the html code within a description of a board?

Meaning if we add a description to a board they have a choice whether to view it or not through profile settings.

Such as viewing Avatars and Signatures, where the member has a choice within their settings.

Chen Zhen

January 13, 2015, 09:41:01 PM #1 Last Edit: January 14, 2015, 12:06:19 AM by Napalm
Fog,

Imo the best way would be to put the HTML img code directly into the board title with a specific unique css class.
Then you have that css class only hide the image if the user has selected them not to be visible within their profile settings (this would need to be set up for that).
The css for it would be put into a separate css file that is only loaded if they have the option of disabling the images ticked within their profile.

This is most likely how I would go about what you are attempting to accomplish.
To be proper so that the class is actually activating something even if the user has the images activated, I would create 2 files where one is display: none; and the other file has display: inline; ... but that is just my habit of attempting to do it by the book whereas just having the file loading and activating the css for display:none; would be sufficient.

If you do it via the internal SMF board title admin settings then you will have to use file(s) as described above because the code you use is parsed and will not execute any logic. However, if you are going to edit the SMF files directly then you do not need to create any extra css files but rather just add unique css classes to the existing theme css file and use conditions for one of your unique class attributes.

Regards.

Fog

I'll have to play around with that idea.

I see how in our profile settings we can choose to view avatars or signatures, I can use this as a reference.

Question though: Won't the img code show up in the navigation bar?


Chen Zhen


Why would anything you put in a board description show up on the navigation menu?

Fog

Quoteput the HTML img code directly into the board title

Do you mean in the board description instead of board title?

Chen Zhen


No I meant the title as in "Full Name" ... how would this show in your nav menu?
Your nav menu (or bar as you described it) says Home Forum etc. etc..
How would altering a board name show up on that nav menu as you previously stated?

Fog

January 19, 2015, 11:38:12 PM #6 Last Edit: January 19, 2015, 11:39:49 PM by Fog
Here's a few screen shots UD...

On the Child Board we have a img code in the full name box

You can see this in the Admin Shot.

Chen Zhen

January 20, 2015, 04:36:28 PM #7 Last Edit: January 20, 2015, 05:37:45 PM by Napalm
Yes but you mentioned the nav bar which is not affected. The nav bar is the list of links that says Home, Forum, Search, etc. I suppose you were referring to the wrong thing in error?
What you are talking about is the board index. This is where you want it to show, correct? So you use HTML img tags to add that as you seem to be doing which is fine. Did you understand my explanation for profile settings and adding logic to determine a css class to use for the behaviour you are seeking?





Let's say for example you have the profile setting done via the $user_info array and the key is "image_css".
ie. $user_info['image_css']  ... if this is true then the images are disabled.

So in a header block, with the hide body and hide title settings enabled (to hide both) you use a custom php block like this:

global $user_info, $settings;

echo '<script type="text/javascript"><!-- // --><![CDATA[
window.onload = function() {
link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";';

if ($user_info['image_css'])
{
echo '
link.href = "' . $settings['default_theme_url'] . '/css/image_css1.css?fin21";';
}
else
{
echo '
link.href = "' . $settings['default_theme_url'] . '/css/image_css2.css?fin22";';
}

echo '
document.getElementsByTagName("head")[0].appendChild(link);
};
// ]]></script>';






Then you create 2 css files and put them into ../Themes/default/css

file: image_css1.css

/* Styles for board index images.
------------------------------------------------------- */
.hide_me
{
display: none;
}


file: image_css2.css

/* Styles for board index images.
------------------------------------------------------- */
.hide_me
{
display: inline;
width: 16px;
height: 16px;
}






You would then use this possible image in your board title (change to your image and title):

<img class="hide_me" src="http://www.zebra.com/content/dam/zebra/photography/location-solutions/LS/nfl-small.png" />&nbsp;NFL Discussion







Fog

Still trying to get the profile settings in place.

Thanks for your help.

Sorry about the confusion on the lingo..