It is currently Tue Sep 07, 2010 9:05 pm

Tutorials

Hard Coding an extra URL in the Profile Fields

Posted by topdown

Note: I will be making a mod for this soon, to reduce edits!


OK, here we go, there are a lot of edits and a few things not included like adding the image.
Here is the hard coded way.

First thing you need to do is Back Up Everything database and files you will be editing. This is a must.

Files you will be editing include
  • includes/ucp/ucp_profile.php
  • styles/prosilver/template/ucp_profile_profile_info.html
  • styles/prosilver/template/memberlist_view.html
  • styles/prosilver/template/viewtopic_body.html
  • viewtopic.php
  • memberlist.php

Spoiler:
OPEN includes/ucp/ucp_profile.php
FIND
Code: Select all
               'website'      => request_var('website', $user->data['user_website']),


On a new line AFTER ADD
Code: Select all
//--------------------------------------------------------------------------------------------------//               
               'extra_link'   => request_var('extra_link', $user->data['user_link']),
//--------------------------------------------------------------------------------------------------//


FIND
Code: Select all
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),


On a new line AFTER ADD
Code: Select all
//--------------------------------------------------------------------------------------------------//
                  'extra_link'   => array(   
                     array('string', true, 12, 255),
                     array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
//--------------------------------------------------------------------------------------------------//


FIND
Code: Select all
                     'user_website'   => $data['website'],


On a new line AFTER ADD
Code: Select all
//-----------------------------------------------------------------------------------------------//
                     'user_link'      => $data['extra_link'],
//-----------------------------------------------------------------------------------------------//


FIND
Code: Select all
               'WEBSITE'   => $data['website'],


On a new line AFTER ADD
Code: Select all
//-----------------------------------------------------------------------------------------------//
               'EXTRA_LINK'=> $data['extra_link'],
//----------------------------------------------------------------------------------------------//

SAVE FILE

OPEN styles/prosilver/template/ucp_profile_profile_info.html
FIND
Code: Select all
   <dl>
      <dt><label for="website">{L_WEBSITE}:</label></dt>
      <dd><input type="text" name="website" id="website" maxlength="255" value="{WEBSITE}" class="inputbox" /></dd>
   </dl>


On a new line AFTER ADD
Code: Select all
   <dl>
      <dt><label for="extra_link">Extra Link:</label></dt>
      <dd><input type="text" name="extra_link" id="extra_link" maxlength="255" value="{EXTRA_LINK}" class="inputbox" /></dd>
   </dl>

Note: In that last code you can see I didn't make a language var, you should.
SAVE FILE

OPEN styles/prosilver/template/memberlist_view.html
FIND
Code: Select all
<!-- IF U_WWW --><dt>{L_WEBSITE}:</dt> <dd><a href="{U_WWW}" title="{L_VISIT_WEBSITE}: {U_WWW}">{U_WWW}</a></dd><!-- ENDIF -->


On a new line AFTER ADD
Code: Select all
      <!-- IF U_USER_LINK --><dt>{L_WEBSITE}:</dt> <dd><a href="{U_USER_LINK}" title="{L_VISIT_WEBSITE}: {U_USER_LINK}">{U_USER_LINK}</a></dd><!-- ENDIF -->

Note: This is using the language var L_WEBSITE, you should make a new one in the language file for this link.

SAVE FILE

OPEN styles/prosilver/template/viewtopic_body.html
FIND
Code: Select all
<!-- IF postrow.U_WWW --><li class="web-icon"><a href="{postrow.U_WWW}" title="{L_VISIT_WEBSITE}: {postrow.U_WWW}"><span>{L_WEBSITE}</span></a></li><!-- ENDIF -->


On a new line AFTER ADD
Code: Select all
               <!-- IF postrow.U_USER_LINK --><li class="web-icon"><a href="{postrow.U_USER_LINK}" title="{L_VISIT_WEBSITE}: {postrow.U_USER_LINK}"><span>USER LINK</span></a></li><!-- ENDIF -->

AGAIN Note: This is using the website language vars, you should change them. It is also using the website icon class="web-icon"

SAVE FILE

OPEN viewtopic.php
FIND
Code: Select all
   'WWW_IMG'          => $user->img('icon_contact_www', 'VISIT_WEBSITE'),


On a new line AFTER ADD
Code: Select all
//--------------------------------------------------------------------------------------
   'USER_LINK_IMG'    => $user->img('icon_contact_www', 'VISIT_WEBSITE'),
//--------------------------------------------------------------------------------------


FIND
Code: Select all
'www'            => '',


On a new line AFTER ADD
Code: Select all
//-----------------------------------------------------
            'user_link'         => '',
//-----------------------------------------------------


FIND
Code: Select all
            'www'         => $row['user_website'],


On a new line AFTER ADD
Code: Select all
//---------------------------------------------------------------            
            'user_link'      => $row['user_link'],
//---------------------------------------------------------------


FIND
Code: Select all
      'U_WWW'         => $user_cache[$poster_id]['www'],


On a new line AFTER ADD
Code: Select all
//---------------------------------------------------------------
      'U_USER_LINK'   => $user_cache[$poster_id]['user_link'],
//---------------------------------------------------------------


SAVE FILE

OPEN memberlist.php
FIND
Code: Select all
         'WWW_IMG'      => $user->img('icon_contact_www', $user->lang['WWW']),


On a new line AFTER ADD
Code: Select all
//------------------------------------------------------------------------------------         
         'USER_LINK_IMG'   => $user->img('icon_contact_www', 'EXTRA_LINK'),
//------------------------------------------------------------------------------------   


FIND
Code: Select all
      'U_EMAIL'      => $email,
      'U_WWW'         => (!empty($data['user_website'])) ? $data['user_website'] : '',


On a new line AFTER ADD
Code: Select all
//------------------------------------------------------------------------------------------------      
      'U_USER_LINK'   => (!empty($data['user_link'])) ? $data['user_link'] : '',
//------------------------------------------------------------------------------------------------


SAVE FILE

Now you will need some SQL added to your database
Open up phpMyAdmin and go to your database, click on the SQL button and run
Code: Select all
ALTER TABLE `phpbb_users` ADD `user_link` varchar(200) collate utf8_bin NOT NULL default ''


There are still some obvious changes to be made like the image, language vars, and naming, but this should get you going.

To add it to the admin email for admin register approval


Files to edit
  • includes/ucp/ucp_register.php
  • styles/your style/template/ucp_register.html
  • language/en/email/admin_activate.txt

NOTE: You'll notice I added an @mod in the break lines, this does nothing, I just added it for a search feature so I can find all code edits easilly in the files for future use ;)

Spoiler:
OPEN includes/ucp/ucp_register.php
FIND
Code: Select all
               'email'            => strtolower(request_var('email', '')),


On a new line AFTER ADD
Code: Select all
//-- @mod ------------------------------------------------------------------------------------------------//               
               'extra_link'   => request_var('extra_link', $user->data['user_link']),
//--------------------------------------------------------------------------------------------------//


FIND
Code: Select all
         'email'            => strtolower(request_var('email', '')),


On a new line AFTER ADD
Code: Select all
//-- @mod ------------------------------------------------------------------------------------------------//               
         'extra_link'      => request_var('extra_link', $user->data['user_link']),
//--------------------------------------------------------------------------------------------------//


FIND
Code: Select all
            'email'            => array(
               array('string', false, 6, 60),
               array('email')),


On a new line AFTER ADD
Code: Select all
//-- @mod ------------------------------------------------------------------------------------------------//
            'extra_link'   => array(   
               array('string', true, 12, 255),
               array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
//--------------------------------------------------------------------------------------------------//


FIND
Code: Select all
               'user_email'         => $data['email'],


On a new line AFTER ADD
Code: Select all
//-- @mod ---------------------------------------------------------------------------------------------//
               'user_link'            => $data['extra_link'],
//-----------------------------------------------------------------------------------------------//


FIND This part is untested :glare: It should include the link to the admins in the activation email.
Code: Select all
                        'USERNAME'         => htmlspecialchars_decode($data['username']),


On a new line AFTER ADD This part is untested :glare: It should include the link to the admins in the activation email.
Code: Select all
//-- @mod ---------------------------------------------------------------------------------------------//
                        'USER_LINK'         => htmlspecialchars_decode($data['extra_link']),
                        //-----------------------------------------------------------------------------------------------//
                        


FIND
Code: Select all
         'EMAIL'            => $data['email'],


On a new line AFTER ADD
Code: Select all
//-- @mod ---------------------------------------------------------------------------------------------//
         'EXTRA_LINK'      => $data['extra_link'],
//----------------------------------------------------------------------------------------------//
         


SAVE FILE

OPEN styles/your style/template/ucp_register.html
FIND
Code: Select all
   <dl>
      <dt><label for="password_confirm">{L_CONFIRM_PASSWORD}:</label></dt>
      <dd><input type="password" tabindex="5" name="password_confirm" id="password_confirm" size="25" value="{PASSWORD_CONFIRM}" class="inputbox autowidth" title="{L_CONFIRM_PASSWORD}" /></dd>
   </dl>


On a new line AFTER ADD
Code: Select all
   <hr />
   <dl>
      <dt><label for="extra_link">Extra Link:</label></dt>
      <dd><input type="text" name="extra_link" id="extra_link" size="25" maxlength="255" value="{EXTRA_LINK}" class="inputbox autowidth"  /></dd>
   </dl>


SAVE FILE

OPEN language/en/email/admin_activate.txt (This part is untested)
FIND
Code: Select all
{U_USER_DETAILS}


On a new line AFTER ADD
Code: Select all
The user's included site link is {USER_LINK}


SAVE FILE

upload, and refresh your templates via the ACP/ styles tab and purge your cache from the Admin main page
Comments & Discussion    Total Comments • 0

SEO phpBB3 tweaks

Posted by topdown

When it comes to SEO, don't cheat, that will get you no where FAST....
But there are always things you can do to improve your SEO.
Here are a couple that may help for phpBB3.

Change you default phpBB3 <title> tags around a little to reflect the content first.
In the overall_header.html
FIND
Code: Select all
<title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title


NOTE: {PAGE_TITLE} doesn't necessarily need to be first, {SITENAME} could be
Change to
Code: Select all
<title>{PAGE_TITLE} &bull; {SITENAME} <!-- IF S_IN_MCP --> &bull; {L_MCP} &bull; <!-- ELSEIF S_IN_UCP --> &bull; {L_UCP}<!-- ENDIF --></title


In the view topic pages we are going to put the topic title first, we really don't care if Google knows its in the viewtopic.php
viewtopic.php
At the bottom FIND
Code: Select all
page_header($user->lang['VIEW_TOPIC'] . ' - ' $topic_data['topic_title']); 


Change to
Code: Select all
page_header($topic_data['topic_title'] . ' - ' $user->lang['VIEW_TOPIC']); 


You can also add them to your Meta description in the overall_header.html
Code: Select all
<meta name="description" content="{SITENAME},{PAGE_TITLE}" />


More to come on SEO
Comments & Discussion    Total Comments • 0

phpBB3 Custom Pages

Posted by topdown

Making Basic Additional pages in PhpBB3 is fairly easy if you follow these instructions.

There are 3 basic files needed
1. HTML template
2. your php file, goes in the root of the forum
3. language definition file php

Lets start with the template

open notepad or a code editor of your choice (NOT WORD, OR ANY MS PRODUCT)

This is the basic code for a prosilver style using the panel bg2 classes with the link back to top arrow like in the topic_body.

Save this file as about_body.html

Code: Select all
<!-- INCLUDE overall_header.html -->
  <
div class="panel bg2">
    <
div class="inner"><span class="corners-top"><span></span></span>
        <
h3>phpBB3 Custom Pages</h3>
        <
p>Put your content here</p>
        <
div class="back2top"><a href="#wrap" class="top" title="Top">Top</a></div>
    <
span class="corners-bottom"><span></span></span>
    </
div>
</
div>
<!-- INCLUDE 
overall_footer.html -->    



Next lets drive this page by making the php file

Code: Select all
<?PHP
/** 
*
* @name about.php
* @version 1.11.26
* @package phpBB WEBMASTERS CMS -custompages.php
* @copyright (c) 2007 topdown, Webmasters United.org 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

// Note: If you would like to have a page in a different location than in the main phpBB3 directory

define('IN_PHPBB'true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH './';
$phpEx substr(strrchr(__FILE__'.'), 1);
// Lets make sure we have all of the variables loaded up for custom pages
include($phpbb_root_path 'common.' $phpEx);
//Lets put this in there also, it has all of the forums useful functions for displaying certain items
include($phpbb_root_path 'includes/functions_display.' $phpEx); 

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('my_lang' 2); //The 2 stands for the style id for this page


// Output page
page_header($user->lang['ABOUT US']);

$template->set_filenames(array(
    
'body' => 'about_body.html')
    
// ENSURE THAT THE ABOVE FILENAME MATCHES THE FILENAME IN phpBB3/styles/subSilver/template
    // dirrectory! (or subBlack whatever template you are using
);

make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));

page_footer();

?>



There are 3 lines that will need editing to make different pages than about us

This line
Code: Select all
page_header($user->lang['ABOUT US']);    

pulls the definition from the lang file we are making next


This line
Code: Select all
$template->set_filenames(array(
    
'body' => 'about_body.html')    

pulls the template up for the browser to display the HTML

The other line closer to the top
Code: Select all
$user->setup('my_lang');    

is the name of the language file used by this page named (my_lang.php)

Save this file as about.php

You should see the edits you need to make to change file names.

Next we make the lang file

Code: Select all
<?php
/** 
*
* @name WEB.php  **language file**
* @version 1.12.07
* @package -WEBpages.php
* @copyright (c) 2008 topdown, Webmasters United.org 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/


/**
* DO NOT CHANGE
*/
if (empty($lang) || !is_array($lang))
{
    
$lang = array();
}


$lang array_merge($lang, array(
    
'ABOUT US'            => 'ABOUT US',
    
'CONTACT US'        => 'CONTACT US',
    
'HOME'                  => 'HOME',
    


        
// copyright
    
'CUSTOM_COPY'     => '&copy; 2008 topdown, Webmasters United.org  All rights Reserved.',
    
    ));

?>


You can see how to add to it

Code: Select all
'HOME'                => 'HOME',    

just copy, paste and rename the HOME to whatever you put in the other files

Then save this file as
my_lang.php


Now upload

about_body.html to your styles template directory
about.php to the root, where the forums index.php file is
and the my_lang.php to the language / en directory

Done

Good luck, :mrgreen:
Comments & Discussion    Total Comments • 0

phpBB Lists

Posted by topdown

Just testing out the article system. ;)

Did you ever notice the slick List (<ul><li></li></ul>) system phpBB3 has in its BBcode options?

It holds structure Check it Out,

  • Main List Head
    • Item 1
    • Item 2
      • Sub List Head
        • Sub Item 1
        • Sub item 2
        • Sub Item 3
          • How about Sub of a Sub
            • Sub of a Sub
      • Bring it back a little
        • Back 1
        • Back 2

Here is the code for what I just did for those that don't get it, it's the List and * buttons in the post box
Spoiler:
Code: Select all
[list][*]Main List Head
[list][*]Item 1
[*]Item 2
[list][*]Sub List Head
[list][*]Sub Item 1
[*]Sub item 2
[*]Sub Item 3
[list][*]How about Sub of a Sub
[list][*]Sub of a Sub[/list][/list][/list][/list]
[list][*]Bring it back a little
[list][*]Back 1
[*]Back 2[/list][/list][/list][/list]
Comments & Discussion    Total Comments • 0
cron