Page 4 of 4

custom page

Posted: 15 Sep 2011, 11:23
by Terr0r
I know what you mean Stoker but I learn a lot from you, rich, steve and cisco

but somethings I don't now what I must do so then I ask for help from you or other people

custom page

Posted: 15 Sep 2011, 11:54
by Stoker
Okay, one last hint.

You have all the code you need for your home.php in index.php
Therefore take all the code from index.php and use it in your home.php
Look through the code and remove whats not needed.

custom page

Posted: 15 Sep 2011, 12:28
by martin123456
Nice topic i used it to create a blog ty stoker

To see the blog you have to be signed in is that a permission thing ? or can i edit the code a little to be able to see the page even when not signed in to the site so cut it short guests can see it.

custom page

Posted: 15 Sep 2011, 15:12
by Stoker
Martin123456, quite off topic here right? :D

Anyway, me offcourse knowing everything about your blog and its code, I will say that you just have to push the "Straight to Mars" button and everything will be fine :lol:

custom page

Posted: 15 Sep 2011, 16:14
by martin123456
Mar's ? i been there too back in 67 alliens took me ;)

Here is my (your code) code i have used before i added contents to it and it works well but i cant view it as a guest you need to login to be able to see the blog page the site is on localhost still i can view the site and posts i have made as a guest just not the blog page (custom page) so any hint on what to remove in the code below to be able to see it as a guest ?

Also credit will be given where it needs too.


Blog.php

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: Blog.php,v 1.0b 2011/09/15 09:50:21 Stoker Exp $
* @copyright (c) 2008 Stoker (www.phpbb3bbcodes.com) 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('');       

if ($user->data['user_id'] == ANONYMOUS)
{
	login_box('', $user->lang['LOGIN']);
}

// BEGIN Welcome Mod
// Get the avatar
if (!function_exists('get_user_avatar'))
{
   include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
//--Welcome_Mod--get the hour number-->
$date = $user->format_date(time(), 'H');

if ($user->data['is_registered'])
{
    $u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
}
else
{
    $u_user_name = $user->lang['WELCOME_GUEST'];
}   

switch (true)
{
        case ($date < 1):
            // if the hour is 11am-12am (18-23)
            $s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
        break;
      
      	case ($date < 4):
            // if the hour is 1-3 am
            $s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
        break;
       
        case ($date < 8):
            // if the hour is 4-7 am
            $s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
        break;
       
        case ($date < 12):
            // if the hour is 8-11 am
            $s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
        break;
       
        case ($date < 18):
            // if the hour is 12-5pm
            $s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
        break;
       
        case ($date < 24):
            // if the hour is 6pm-11pm
            $s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
        break;
} 

// how long a member for
$member_for = '';
if ($user->data['is_registered'] && !$user->data['is_bot'])
{
    $member_length = time() - $user->data['user_regdate'];
    $years = $months = $days = 0;
    $member_for = '';
    if ($member_length)
    {   
        if ($member_length >= 31536000)
        {
            $years = floor($member_length / 31536000);
            $member_length = $member_length - ($years * 31536000);
            $member_for .= $years > 1 ? ($years . '&nbsp;' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . '&nbsp;' . $user->lang['WELCOME_YEAR'] . ', ');
        }
        $months = floor($member_length / 2628000);
        if ($months)
        {
            $months = $months > 1 ? ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . '&nbsp;' . $user->lang['WELCOME_MONTHS'] . ', ');
            $member_length = $member_length - ($months * 2628000);
            $member_for .= $months;
        }
        $days = floor($member_length / 86400);
        if ($days)
        {
            $days = $days > 1 ? ($days . '&nbsp;' . $user->lang['WELCOME_DAYS']) : ($days . '&nbsp;' . $user->lang['WELCOME_DAY']);
            $member_for .= $days;
        }       
    }
}

$template->assign_vars(array(  
    'S_WELCOME'                   => $s_welcome,
    'S_JOINED_DATE'               => $user->lang['JOINED'] . ':&nbsp;' . $user->format_date($user->data['user_regdate']),
    'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
    'MEMBER_FOR'               => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . '&nbsp;' . $member_for : '',
    ));
// END Welcome Mod

page_header('BLOG');

$template->set_filenames(array(
	'body' => 'Blog_body.html',
));

page_footer();

?>

Blog_body.html

Code: Select all

<!-- INCLUDE overall_header.html -->
<!-- IF not S_IS_BOT -->
<div class="forabg">
         <div class="inner"><span class="corners-top"><span></span></span>
         <ul class="topiclist">
            <li class="header">
               <dl class="icon">
                  <dt>{L_WELCOME_TO_MOD} {SITENAME}</dt>
                                              </dl>
            </li>
         </ul>
         <ul class="topiclist forums">
         <li>
            <dl>
               <dd style="padding:5px; text-align: center; border:none;">
               <!-- IF USER_AVATAR -->{USER_AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF -->
               </dd>
               <dd class="lastpost" style="padding:5px; width:40%;">
               <p>{S_WELCOME}</p>
               <span><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<br />{CURRENT_TIME}<!-- ELSE -->{CURRENT_TIME}<!-- ENDIF --><!-- IF S_USER_LOGGED_IN --><br /><br />{S_JOINED_DATE}<br />{MEMBER_FOR}<!-- ENDIF --></span>
               </dd>
               <dd class="lastpost" style="padding:5px; width:36%;"><span>{TOTAL_POSTS} &bull; {TOTAL_TOPICS}<br />{TOTAL_USERS}<br />{NEWEST_USER}
               <!-- IF S_DISPLAY_ONLINE_LIST --><br /><br />{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<!-- ENDIF --></span>
               </dd>
            </dl>
         </li>
         </ul>
<span class="corners-bottom"><span></span></span></div></div>
<!-- ENDIF -->
    <h2>test blog</h2>

    <div class="panel">
       <div class="inner"><span class="corners-top"><span></span></span>

       <div class="content">
          <p>
             BLOG1
             
             BLOG2:
             <ul>
                <li>BLOG3</li>
                <li>BLOG4</li>
                <li>BLOG5</li>
             </ul>
          </p>
       </div>

       <span class="corners-bottom"><span></span></span></div>
    </div>

    <!-- INCLUDE overall_footer.html -->

custom page

Posted: 15 Sep 2011, 16:18
by Stoker

Code: Select all

if ($user->data['user_id'] == ANONYMOUS)
{
   login_box('', $user->lang['LOGIN']);
}

custom page

Posted: 15 Sep 2011, 16:28
by martin123456
Ty stoker i was going to remove that part and try it out guess i should have my playing with code skills are low but i tend to have a go before asking.

May be you should bundle the files together and offer them a custom page mod ? just an idea

custom page

Posted: 15 Sep 2011, 16:29
by Stoker
Sure, a custom page is no problem.
What do you want in it?

custom page

Posted: 15 Sep 2011, 17:19
by martin123456
I think its fine as it is using the codes in my last post after all it's a learning curve adding stuff to it.

But as you/we need to edit the custompage _body.html file in the prosilver/template/folder it would be nice to have a purge the cache button within the custom page that only admin can see (as we would need to refresh the cache after every edite done if it's not to much coding for you.

I dont know if you know this but stargate portal has a purge the cache button on the portal yet again it only works for admin.