Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved [How To?] IF mobile Read More
#1
Not Solved
Hello. With the plugin template conditionals we can use IF commands. I'm using bootstrap at my forum, and want to make a "read more/ or collaps" option to xs (mobile phones) in potal.php.

Is there a way of coding the portal to show lets say 100 characters or string, then add a read more button or a collaps button, but for bigger screens show the whole content?

OR is it possible to use the plugin Portal News Preview and duplicate the plugin (change name for one of them) and let one of the plugin work at screens bigger then xs, and the other plugin at only xs devices?

Hope someone will take the time to help me
Reply
#2
Not Solved
Responsive frameworks have built in functions to deal with this. Both Bootstrap and W3, which is less dependent on javascript and easier to learn. W3 eg. has the classes hide-small, hide-medium, hide-large to help achieve what you trying to do.
What goes around comes around
Reply
#3
Not Solved
That is not what I mean. I do not want to hide it that way, just want it to show the content when pressing read more.
Using hide code will hide the content, and will not be able to show the content pressing a button.
Reply
#4
Not Solved
(2016-06-10, 08:40 AM)BaggerHD Wrote: That is not what I mean. I do not want to hide it that way, just want it to show the content when pressing read more.
Using hide code will hide the content, and will not be able to show the content pressing a button.

Not true. You can use any icon to trigger the collapse to show the content you're hiding.
What goes around comes around
Reply
#5
Not Solved
OK, so should I then use a IF commando inside 2 different <div>, one for IF xs, and one for the rest, and inside the two different div's use a max height before breakpoint for the collapse? Or is there a different way to do it?
Reply
#6
Not Solved
i would not use php conditionals on this at all. Why not make the whole description collapse on the small screen with a trigger button. If you insist on displaying the first say 100 characters, then you are going to need to change the core code. Eg I can think of is in portal.php where the latest thread subject get's truncated to 25 characters.

		if(my_strlen($thread['subject']) > 25)
		{
			$thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
		}
What goes around comes around
Reply
#7
Not Solved
There happens to be an addon for this, no need to reinvent the wheel:

http://community.mybb.com/mods.php?action=view&pid=373
What goes around comes around
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)