Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 11:16:00 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155531 Posts in 21713 Topics by 7738 Members
Latest Member: Pattieardathfe
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Read more in percentage IDEA!  (Read 499 times)
Mirens

Offline Offline

Posts: 11


« on: December 15, 2009, 01:57:50 AM »

I am trying to make read more "button" with progress bar using news module. lol just a sec...
What I managed to do is insert PHP code in view.php of news module after line 250

Code:
$kratka = strlen($post['content_short']);
$duga = strlen($post['content_long']);
$count1 = $kratka / $duga;
$count2 = $count1 * 100;
$count = number_format($count2, 0);
echo $count . "%";

This simply counts characters of the long message and short message and make a percentage calculation (what percent is short message of long message) simple formula.

Now to show you the idea, I manage to print the percent before short news block, but that is offcourse not what Im trying to do.
I created a <div> with image inside that div, simple gradient, its filling some part of that div. I put one more div over it (div in div) and there I put read more link. See the picture

You can see the percentage before message I managed to calculate, now that gradient image behind read more link. I would like to make it stretch based on calculation of percentage.

If I make function of that code I inserted I guess I could call something like this
Code:
<img width="function percentage()"...>
So it will fill the div, behind read more link, to the percentage folowed by the text "You are curently reading x% of the full message"

Can someone put me in some direction now, what files to edit next and where? I dont know anything about PHP.

And maybe this allready exist so someone could save my time  grin
Logged
crnogorac081
AddOn Development
*
Online Online

Posts: 1706



« Reply #1 on: December 15, 2009, 04:10:26 PM »

Wow, nice idea, I like it. It could also be: Read additional 57% of this article Smiley
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Mirens

Offline Offline

Posts: 11


« Reply #2 on: December 15, 2009, 06:59:50 PM »

Your sugestion is even better... Now only if someone could make us move  grin

Greetings from Novi Sad  cheesy
Logged
crnogorac081
AddOn Development
*
Online Online

Posts: 1706



« Reply #3 on: December 15, 2009, 07:33:06 PM »

 aj dobro dosa u WB : zajednicu )Smiley
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
BerndJM

Offline Offline

Posts: 1764



« Reply #4 on: December 16, 2009, 03:21:11 AM »

Hi,

no idea if this works:
make a droplet from your function (for reference how to make a droplet ->
http://www.websitebakers.com/pages/droplets/help/help-en.php)
and call this droplet in the news ...

Regards Bernd
Logged

In theory, there is no difference between theory and practice. But, in practice, there is.
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!