Show the name of the current page

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
pieterbeulens
Posts: 29
Joined: Fri 10. Dec 2004, 13:08
Location: Rotterdam, The Netherlands
Contact:

Show the name of the current page

Post by pieterbeulens »

Hi there,

I want to be able to show the name of the current page in a separate div from the menu (like a header), and not above the article. How can I display this name in a seperate div from within the template?

I hope it's clear what I mean... You can also take a look at http://www.pjdenhaan.com to see what I mean.
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

maybe you can modify the Article-Template -you have a Sample for that in

../phpwcms_template/inc_cnttpart/articlesummary/article/sample.tmpl

wich you can select when creatin/editing a Article.
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
pieterbeulens
Posts: 29
Joined: Fri 10. Dec 2004, 13:08
Location: Rotterdam, The Netherlands
Contact:

Post by pieterbeulens »

I'm afraid I don't really understand what you're suggesting. How can this provide me with an automaticly generated title?

Isn't there a piece of PHP code which I could put in the template that checks on which page the user is and gets the name of that page from the database? I'm really bad at PHP, so that's why I was hoping that someone here could help me out.
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Ok - maybe I hit now what you want :wink:

think you need a little Code like a 'small Breadcrumb'

this is the Code for the original Breadcrumb-Function - so you can reduce it for your need.

Code: Select all

function breadcrumb ($start_id, $struct_array, $end_id, $link_to="index.php", $spacer=" > ") {
	//builds the breadcrumb menu based on given values
	//$link_to = the page on which the breadcrum part links
	//$root_name = name of the breadcrumb part if empty/false/0 $start_id
	//$spacer = how should breadcrumb parts be divided
	
	$start_id = intval($start_id);
	$end_id = intval($end_id);
	$act_id = $start_id; //store actual ID for later comparing
		
	while ($start_id) { //get the breadcrumb path starting with given start_id
		$data[$start_id] = $struct_array[$start_id]["acat_name"];
		$start_id		 = $struct_array[$start_id]["acat_struct"];
		if($end_id && $start_id == $end_id) break;
	}
	$data[$start_id] = $struct_array[$start_id]["acat_name"];
	$crumbs_part = array_reverse($data, 1);	
	
	if(sizeof($crumbs_part)) {
		$breadcrumb = "";
		foreach($crumbs_part as $key => $value) {	
			$alias = '';
			if ($act_id != $key) {
				if($breadcrumb) $breadcrumb .= $spacer;
				if(!$struct_array[$key]["acat_redirect"]) {
					$breadcrumb .= '<a href="index.php?';
					$alias = $struct_array[$key]["acat_alias"];
					$breadcrumb .= ($alias) ? html_specialchars($alias) : 'id='.$key.',0,0,1,0,0';
					$breadcrumb .= '">';
				} else {
					$redirect = get_redirect_link($struct_array[$key]["acat_redirect"], ' ', '');
					$breadcrumb .= '<a href="'.$redirect['link'].'"'.$redirect['target'].'>';
				}
				$breadcrumb .= html_specialchars($crumbs_part[$key]).'</a>';
			} else {
				if($breadcrumb) $breadcrumb .= $spacer;
				$breadcrumb .= html_specialchars($crumbs_part[$key]);
			}
		}
	} else {
		$breadcrumb = "";
	}
	return $breadcrumb;
}
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
brans

Post by brans »

ouhm I guess that you'd just have to layout your css right.. take the latest phpwcms release DEV 1.2.3 and position your content title where you have it atm. I guess this is what you need. Apart from that the
{PAGETITLE} RepTag at --...-- could help you out?
Post Reply