Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Nov 2003
Posts: 329
Beta Tester
Beta Tester
Offline
Joined: Nov 2003
Posts: 329
Part 2 weekly Most popular (well last 7 days).
And Ive hijacked a existing island so cache is still valid and working. And you can control the cache time from the control panel.

Whats involved ?

We hijack Top Posters island as its static and boring.
We add a New Language text for the island.
Update the Language file so Top posters is renamed to Weekly Popular.
We duplicate and exiting tpl file and add a tiny tweak.

* * * * * * * * * *
NOTICE : I'm no expert on this so will say its probably can be improved on but Its above my pay grade lol.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

You can do this Live if you do not have "Top Posters Island" on view.

1. find /cache_builders
2. Look for the following files.

popular_topics.php (its the file from my first hack above).
top_posters.php

make a backup of top_posters.php

Open both files and copy the contents from popular_topics.php into top_posters.php

We need to edit a couple of lines in top_posters.php


Change the -1 to -7
Code
//-------------------------
$topic_created = strtotime('-1 days'); // ADD THIS
//-------------------------

Scroll to the bottom of the file.

Code
$smarty->assign("topics",$topics);

$island = $smarty->fetch("island_popular_topics.tpl");

lock_and_write("{$config['FULL_PATH']}/cache/popular_topics.php",$island);

@chmod("{$config['FULL_PATH']}/cache/popular_topics.php",0666);

change to

Code
$smarty->assign("topics",$topics);

$island = $smarty->fetch("island_popular_topics_week.tpl");

lock_and_write("{$config['FULL_PATH']}/cache/top_posters.php",$island);

@chmod("{$config['FULL_PATH']}/cache/top_posters.php",0666);

Close and Save.

3. Next we create a new tpl file.

Navigate to templates/default
find island_popular_topics.tpl

copy and paste to make a new file called island_popular_topics_week.tpl

You should now have these two files

island_popular_topics_week.tpl
island_popular_topics.tpl

open up the island_popular_topics_week.tpl

we need to modify 1 line in there for the language file update.

find
Code
<?php echo $ubbt_lang['POPULAR_TOPICS'] ?>
and change to
Code
<?php echo $ubbt_lang['POPULAR_TOPICS_WEEK'] ?>

save and close

Make sure your do not have "Top Posters" island active just yet.

Upload the files as there are only changes in the control panel to make now.


UBB Control panel.

language editor search for popular and then click on edit (it should land you at portal_islands.php)

Dont copy and paste the text from POPULAR_TOPICS as it will kill your island as its not parsing in to the language editor properly but this is the work around.

at the bottom empty spaces

KEY
POPULAR_TOPICS_WEEK
Description just put a . (Full stop).
Then update and it will update with out an issue.
You can now copy and paste the similar text from the POPULAR_TOPICS description field and update.

Almost there.

Control panel Portal Layout. Over to the right side click on External view.
It will probably show the original top posters.
Clear the cache.
Go back and click on external view and you should now see the weekly most viewed topics.


FINAL
is just house work really.
Portal Settings update the cache setting for "Top posters"
Language file editor do searches to edit the control panel display from "Top Posters" to "Weekly most popular".

I think that's all of it.

* You can modify the island files in the cache builders to change the limits on how many should be visible for faster or slower forums.

Why re invent the wheel when its been half done.


G !
Feel free to tidy this post / topic smile

Enjoy !


BOOM 7.6.+ rocks....
Sponsored Links
Entire Thread
Subject Posted By Posted
Most Read : Today / Week Most Replied This Week Mark_S 11/05/2014 6:37 AM
Re: Most Read : Today / Week Most Replied This Week Mark_S 11/10/2014 12:09 PM
Re: Most Read : Today / Week Most Replied This Week Mark_S 11/15/2014 4:43 PM
Re: Most Read : Today / Week Most Replied This Week Gizmo 11/15/2014 10:08 PM
Re: Most Read : Today / Week Most Replied This Week Bill B 11/20/2014 5:04 PM
Re: Most Read : Today / Week Most Replied This Week Mark_S 01/15/2018 6:57 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)