the questions :
1. How can I make a page without using Page Manager like I made before for http://lenkbreak.host56.com/ ?
The confusing part is, how to separate that php codes and html codes? I mean, in a new page i have to put php codes and in global template i have to put html codes, do i just separate those codes and just paste it? or can I use PHP in template plugin so i can make a new template with php code inside directly?
(04-11-2012 11:50 AM)lenkbreak Wrote: you know what? this is what I like from community like this!!
people like you and adisp007 share their knowledge with noobs like me and never ask to be pay
(04-11-2012 12:30 PM)lenkbreak Wrote: @adisp007 and @rateu
I forgot to ask you something
can you give me some suggestions for me?
Another US$1mill. Yes!!!
(04-11-2012 12:30 PM)lenkbreak Wrote: the questions :
1. How can I make a page without using Page Manager like I made before for http://lenkbreak.host56.com/ ?
The confusing part is, how to separate that php codes and html codes? I mean, in a new page i have to put php codes and in global template i have to put html codes, do i just separate those codes and just paste it? or can I use PHP in template plugin so i can make a new template with php code inside directly?
You can try to use this function (attached).
Upload the file to your forum dir. You can place it at the same folder with your custom index.
Include the file to your custom index, and try to use the function to load the latest threads/posts or the most viewed/replies threads from a specified forums.
The settings is like this:
PHP Code:
1 2 3 4 5 6 7 8 9 10 11
$latest_threads_options=array('type'=>'threads',// available options: threads or posts
'limit'=>5,// how many threads/posts should be displayed
'order_by'=>'dateline',// available options: dateline, views or replies
'order_dir'=>'desc',// available options: asc or desc
'fids'=>'1,2',// from which forum(s) the threads/posts should be pulled out
'fids_format'=>'IN',// available options: IN or NOT IN
'childtemplate'=>'latest_threads_thread',// template and variable name for each data in Global Template. List this template in the $templatelist to cache it
'maintemplate'=>'latest_threads',// template name for holding all of the data in Global Template. List this template in the $templatelist to cache it.
'maxchars'=>30// Max chars for the thread/post title should be displayed
);
Then, you can call it like this (in your custom page code):
<?php
define('IN_MYBB',1);
define('THIS_SCRIPT','myindex.php');$templatelist='example,latest_threads_thread,latest_threads,latest_posts,latest_posts_post,hot_threads,hot_threads_thread,popular_threads,popular_threads_thread';require_once'./forum/global.php';require_once'./mn_functions_tp_load.php';// Displaying 5 latest threads from forum id 2 and 3
$latest_threads_options=array('type'=>'threads','limit'=>5,'order_by'=>'dateline','order_dir'=>'desc','fids'=>'2,3','childtemplate'=>'latest_threads_thread','maintemplate'=>'latest_threads','maxchars'=>25);$latest_threads= mn_tp_load($latest_threads_options);// Displaying 5 latest posts from forum id 3,4,5
$latest_posts_options=array('type'=>'posts','limit'=>5,'order_by'=>'dateline','order_dir'=>'desc','fids'=>'3,4,5','childtemplate'=>'latest_posts_post','maintemplate'=>'latest_posts','maxchars'=>30);$latest_posts= mn_tp_load($latest_posts_options);// Displaying 8 most replied threads from forum id 5
$hot_threads_options=array('type'=>'threads','limit'=>8,'order_by'=>'replies','order_dir'=>'desc','fids'=>5,'childtemplate'=>'hot_threads_thread','maintemplate'=>'hot_threads','maxchars'=>25);$hot_threads= mn_tp_load($hot_threads_options);// Displaying 8 most viewed threads from forum id 6,7
$popular_threads_options=array('type'=>'threads','limit'=>8,'order_by'=>'views','order_dir'=>'desc','fids'=>'6,7','childtemplate'=>'popular_threads_thread','maintemplate'=>'popular_threads','maxchars'=>25);$popular_threads= mn_tp_load($popular_threads_options);eval('$example .= "'.$templates->get('example').'";');
output_page($example);?>
Put {$latest_threads}, {$latest_posts}, {$hot_threads} and {$popular_threads} variable in your custom index template (maybe you need to design it):
Note that the {$latest_threads_thread} variable calls the latest_threads_thread template (the child template for the Latest Threads block). The template hold each latest thread data: latest_threads_thread template (for example only):
Data array you can use in this template: {$data['tplink']} : thread/post subject (linked) {$data['author']} : thread/post author's username (linked) {$data['tpdate']} : thread/post date submitted {$data['tptime']} : thread/post date submitted {$data['views']} : thread/post views {$data['replies']} : thread/post replies
More question for RateU (I hope this is not another $1mil )
From scripts you above, I can make a table with new threads from specify forum. But how can I make 2 or more table with new threads from specify forum?
I'm tried make this function and put it in my custom page
PHP Code:
1 2 3 4 5 6 7 8 9 10 11 12
// Displaying 5 latest threads from forum id 11
$latest_threads_othersports_options=array('type'=>'threads','limit'=>5,'order_by'=>'dateline','order_dir'=>'desc','fids'=>'11','childtemplate'=>'latest_threads_thread_othersports','maintemplate'=>'latest_thread_othersports','maxchars'=>25);$latest_threads_othersports= mn_tp_load($latest_threads_othersports_options);
(04-20-2012 02:52 PM)lenkbreak Wrote: how to set if I want to displaying 5 latest thread from all forum?
Try the update. There is an additional settings needed to add to your array settings:
PHP Code:
'fids_format'=>'NOT IN',
Available options are: IN or NOT IN
Example:
PHP Code:
1 2 3 4 5 6 7 8 9 10 11
// Latest threads from all forums except forum id 2, 3 and 4
$latest_threads_options=array('type'=>'threads','limit'=>2,'order_by'=>'dateline','order_dir'=>'desc','fids'=>'2,3,4','fids_format'=>'NOT IN','childtemplate'=>'latest_threads_thread','maintemplate'=>'latest_threads');
You can use 0 as fids value. Just make sure that you don't have a forum that has a View Own Threads setting. If you have it, add the forum id(s) into the fids list, so it will be excluded from the result (if you use NOT IN in fids_format setting).