Recent Topics

1 May 12, 2008 21:51    

My b2evolution Version: 2.x

I have a blog with two main templates. The index.main.php and the posts.main.php.

I have created a new page by using the “/blog.php?disp=nameofpage” method.

When I call that page it gets displayed using the index.main.php template. Is there a way to make it display with the posts.main.php template?

Any help is appreciated, thank you.

2 May 12, 2008 21:56

use a stub file ;), you can easily change the display handlers in the core files, dont know what you d like to do exactly, but try finding an alternative way rather than core changing

3 May 12, 2008 22:11

I am not sure if I can call a specific main template inside a skin using a stub file.

Basically I created an About page using the "www.blogname.com/blog.php?disp=about" method.

When I pull that page up it uses the index.main.php template. I want it to use the posts.main.php template.

I feel like there is a small bit of php that I can add to the top of my about page to make it do this, but I am not sure.

4 May 12, 2008 22:19

7ontheline wrote:

I am not sure if I can call a specific main template inside a skin using a stub file.

Basically I created an About page using the "www.blogname.com/blog.php?disp=about" method.

When I pull that page up it uses the index.main.php template. I want it to use the posts.main.php template.

I feel like there is a small bit of php that I can add to the top of my about page to make it do this, but I am not sure.

firstly, do use a stub file :) , then open your stub file and change 'require $inc_path.'_blog_main.inc.php';
' duplicate the blog_main.inc and change that line adressing to the new one..

then open the new blog_main.inc.duplicate.php and you will see;


		$disp_handlers = array(
				'arcdir'         => 'arcdir.main.php',
				'catdir'         => 'catdir.main.php',
				'comments'       => 'comments.main.php',
				'feedback-popup' => 'feedback_popup.main.php',
				'mediaidx'       => 'mediaidx.main.php',
				'msgform'        => 'msgform.main.php',
				'page'           => 'page.main.php',
				'posts'          => 'posts.main.php',
				'profile'        => 'profile.main.php',
				'single'         => 'single.main.php',
				'subs'           => 'subs.main.php',


you can change the dips handlers however you like in here..

btw, you can directly do these changes ofc, but duplicating is a kind of backup : P

5 May 12, 2008 22:38

I decided to just add a line to the _blog_main.inc.php file in the $disp_handlers array

'about'           => 'posts.main.php',


I now get the right main template to display however nothing from my _about.disp.php file shows up.

Any ideas?

6 May 12, 2008 22:46

I figured it out. After adding the above code I needed to add the following into my posts.main.php for it to know what page to display.

<?php
		skin_include( '$disp$', array(
				'disp_about'     => '_about.disp.php',
			) );
		
	?>

Thank you for all the help.

8 May 12, 2008 22:54

Right, I used the link above to create the About page however I needed to add the line of code to the "_blog_main.inc.php" in order to get the correct main template to display.

9 May 12, 2008 23:09

You don't have to change _blog_main.inc.php if you did step 1 from that FAQ

10 May 13, 2008 00:52

Is there a way to display a specific article post such as this:

http://yoursite.com/index.php?disp=135

where 135 is my article # 135?

UPDATE: Sorry guys, as soon as I asked this I realize what I really want is just a direct link to article #135... Duh!

In my case, I'm building a spanish version of my site and I want a menu item that says "En Español"... when people click there, I was thinking of putting a disp=espanol, but - all i need is a direct link to that given welcome page... which happens to be an article #.

13 May 13, 2008 17:01

Hi 7ontheline. Just wanted to say it *was* using the correct file to display a single page. "posts.main.php" is for multiple posts. A custom disp is not multiple posts, so of course it should not use that template for those pages.

Seems you've found a way to your own personal happiness, but I figured I would chime in on a minor detail anyway. Cheers!


Form is loading...