Recent Topics

1 May 01, 2007 06:25    

Inspired by: [url=http://forums.b2evolution.net/viewtopic.php?t=9140]A dedicated "disp=about" page [1.8.1 Hack][/url]

Step 1.1: Open /skins/_dispatch.inc.php and LOOK for:


			'subs'     => '_subscriptions.php',

Step 1.2: Add below it your custom pages (example below):


			'about'     => '_about.php',

Step 2.1: Create a new _about.php and put this template:


<?php
//Check page isn't being accessed directly
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
{
//Show About page
?>


<div class="bPost">
	<h2 class="bTitle"><?php echo T_('About YOUR SITE') ?></h2>
	<div class="bText">
		PUT YOUR CONTENT HERE
	</div>
</div>


<?php
}
?>

Step 3.1: Upload the files to /skins/ folder (NOT /skins/YOUR-SKIN/ folder)

* In my opinion, it is better to put your custom pages on the /skins/ folder instead of /skins/YOUR-SKIN/ folder, for the sole reason of you'll likely use the same page for every skin you have.

This will avoid you copying the same file over and over again for each of your skin. And if your skin has a different coding for formatting (example, you don't use class=bPost [which is b2e default]), just copy your custom pages to that specific skin and b2e will load that (customized version of your) file.

Step 4.1: You can access it via http://YOURDOMAIN.tld/?disp=about or http://YOURDOMAIN.tld/index.php?disp=about
* If you have a custom page "feeds", then you can access it via http://YOURDOMAIN.tld/?disp=feeds or http://YOURDOMAIN.tld/index.php?disp=feeds
And so on...

Enjoy!

^_^

2 May 01, 2007 07:10

Nice one, Laibcoms. Keep up the good works.

If you copy/paste this code mind the following: there should be no spaces or New Lines before the first <?php or after the last ?>.

3 May 01, 2007 16:55

Nice! Much easier than my version, and doesn't require core file hacks. OTOH it doesn't give any custom love to the page title, if that matters.

In addition to Afwas' info I'll state that it's much better in the skins/yourskin folder because, like it or not, skins don't follow a standard pattern. A majority will align with the 'custom' skin, but enough don't that if you offer skin switching to your visitors (or randomly change skins just because), you're probably better off making a unique copy for each skin. My opinion only eh?

Well done!

4 May 01, 2007 17:16

Thanks Liabcoms
I'll post a link in that old post of mine to refer to this one..
I didn't even know about _dispatch.inc.php back then :)

5 May 01, 2007 21:05

you really don't need to hack _dispatch.inc.php huh?


if( $disp == 'foo' )
{
  // take "foo" action or require foo.php or ../foo.php whatever
}
else
{
	require $skins_path.'_dispatch.inc.php';
}

You can also do it via a plugin but you need to change $disp to something valid, like "single", otherwise you get an error.

¥

6 May 02, 2007 03:12

@ ¥åßßå
Could you please expand a little on your snippet of code in the context of the _about.php in the first post.
I'm not sure of what goes where in this attempt to not hack _dispatch.inc.php

if( $disp == 'foo' )
{
  // take "foo" action or require foo.php or ../foo.php whatever
}
else
{
    require $skins_path.'_dispatch.inc.php';
}

7 May 02, 2007 03:29

John wrote:

@ ¥åßßå
Could you please expand a little on your snippet of code in the context of the _about.php in the first post.
I'm not sure of what goes where in this attempt to not hack _dispatch.inc.php

if( $disp == 'foo' )
{
  // take "foo" action or require foo.php or ../foo.php whatever
}
else
{
    require $skins_path.'_dispatch.inc.php';
}

yah same... though what I'm thinking, but might be wrong is something like this?


if( $disp == 'about' OR $disp != 'feeds' )
{ // We must display a sub template:
	$disp_handlers = array(
			'about'		=> '_about.php',
			'feeds'		=> '_feeds.php',
		);

	$disp_handler = $disp_handlers[$disp];
		
	if( file_exists( $current_skin_includes_path.$disp_handler ) )
	{	// The skin has a customized handler for this display:
		require $current_skin_includes_path.$disp_handler;
	}
	else
	{	// Use the default handler from the skins dir:
		require $skins_path.$disp_handler;
	}
}
else
{
	require $skins_path.'_dispatch.inc.php';
}

something like that ¥?

EdB wrote:

Nice! Much easier than my version, and doesn't require core file hacks. OTOH it doesn't give any custom love to the page title, if that matters.

In addition to Afwas' info I'll state that it's much better in the skins/yourskin folder because, like it or not, skins don't follow a standard pattern. A majority will align with the 'custom' skin, but enough don't that if you offer skin switching to your visitors (or randomly change skins just because), you're probably better off making a unique copy for each skin. My opinion only eh?

Well done!

Hmm... page title.. good point ^^

It's true, making a unique copy for each skin is the better choice, though I think it is for those who rely on downloadable skins ^^
I tried using one central file, if I use the default class and id names of b2e, it's doable but it'll take a lot of time to edit existing skins.
Dunno, I think the default b2e class and id names are there for a reason ^^ but theme/skin makers tend to ignore them (myself included), for one, it's so time-consuming to convert your names to b2e's.

8 May 02, 2007 11:25

Sorry, I was a tad consise huh? :P

It was more in answer to EdB's "you're probably better off making a unique copy for each skin", in which case you might as well just handle the disp stuff inside the skin similar to how I posted.

I approached this in a tad of a different way with a plugin that allows you to include a page in it's content. That way you could just use your linkblog as a custom pages blog. You can see a demo post [url=http://www.waffleson.co.uk/2006/11/29/playing_with_custom_pages]here[/url]

¥

9 May 02, 2007 11:52

mmm... thanks for the explanation Killer
I'll stick with current methods until you release your Swiss Army Knife linkblog plugin :)

10 May 02, 2007 12:35

You might be in for a tad of a wait, I started my linkblog plugin in 1.6 :p

¥


Form is loading...