Jump to content

change link in php in oscommerce


virtualadz

Recommended Posts

ok just some guy thanks for your advice. one more thing in my oscommerce online shop there is only a default title for every page. i want different titles for each page. but i dont want to enter manual values. have a look at this codedefine('NAVBAR_TITLE', 'Conditions of Use'); in every page there is this code that shows where i am currently in my siteexample: Home >> Conditions of Useso i want to set the title of the page on the text of this code('NAVBAR_TITLE', 'Conditions of Use'); here the text is "Conditions of Use" so i want to set the title depending upon individual navbar titles. how can i do that. can you please write a code. there is a file breadcrumb.php . hope it is clear, please help

Link to comment
Share on other sites

as i had said before i dont want to enter details manually. the default page title "Bhura Tea" , please visit http://store.bhuratea.com , and check it. there you then navigate to the product "Darjeeling Tea" . now you will see in a bar above Home >> Darjeeling Teai want to set this darjeeling tea to be the title of that page asBhura Tea | Darjeeling Tea (this will be page title based on the navbar), now you are suggestion to manually add navbar to each page it is not possible (as many pages are there) . let me explain you one more thing, when you visit my site, and navigate through all four products you will find that the heading title of each product page is different, but before that there was also a default text as "Products" now i did not enter their values manually, instead used the category names to be the heading titles. i did this by editing these files by these codes:go to includes/classes/breadcrumb.php and look for class breadcrumb {var $_trail;function breadcrumb() {$this->reset();}Change to:class breadcrumb {var $_trail;function last() {$trail_size = sizeof($this->_trail);return $this->_trail[$trail_size-1]['title'] ;}function breadcrumb() {$this->reset();}now go to Directory: includes/languages/english/index.phpand Around Line 19:define('HEADING_TITLE', 'Let\'s See What We Have Here');Alter to:define('HEADING_TITLE', $breadcrumb->last());Around Line 39:define('HEADING_TITLE', 'Categories');Alter to:define('HEADING_TITLE', $breadcrumb->last() . ' ' . 'Categories');hope it is clear

Link to comment
Share on other sites

You need to change the page title on the page, there's no way around it. If you want the title to change, then you need to change it. It won't happen by itself. You need to find on the index page where the page title is being set. You might need to look in a template or something, since I don't have all the code in front of me I can't tell you where to look. But you need to find where the page title is being set, and change it to what you want. It might be in one place, it might be in 20 places, like I said I don't have the code in front of me so I don't know specifically what you need to change.

Link to comment
Share on other sites

in index.php there is this code<?php echo TITLE; ?>this code shows the default text title "Bhura Tea"have a look at this file, breadcrump.php , i dont understand much of it, but by seeing it i assume that there are title words in it so may be by editing this we can do something, just like i said in my previous reply how category name was changed by editing breadcrump.php text. have a lookbreadcrumb.php<?php/* $Id: breadcrumb.php,v 1.3 2003/02/11 00:04:50 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License*/ class breadcrumb {var $_trail;function last() {$trail_size = sizeof($this->_trail);return $this->_trail[$trail_size-1]['title'] ;}function breadcrumb() {$this->reset();} function reset() { $this->_trail = array(); } function add($title, $link = '') { $this->_trail[] = array('title' => $title, 'link' => $link); } function trail($separator = ' - ') { $trail_string = ''; for ($i=0, $n=sizeof($this->_trail); $i<$n; $i++) { if (isset($this->_trail[$i]['link']) && tep_not_null($this->_trail[$i]['link'])) { $trail_string .= '<a href="' . $this->_trail[$i]['link'] . '" class="headerNavigation">' . $this->_trail[$i]['title'] . '</a>'; } else { $trail_string .= $this->_trail[$i]['title']; } if (($i+1) < $n) $trail_string .= $separator; } return $trail_string; } }?>

Link to comment
Share on other sites

The breadcrumb file isn't important for this. You need to build the title in the index. Start with the constant TITLE if you always want Bhura Tea to show up. Detect if you are on another page (like a product page) and append the product name to the title. It looks like to detect a product page you can look for the existence of product_id in the querystring, and to find out if you are on a section page you can probably look for cPath in the querystring. If I'm guessing right, from the code you posted above, it looks like $breadcrumb->last() holds the page title.

<?php$page_title = TITLE;if (isset($_GET['cPath']) || isset($_GET['product_id'])  $page_title .= " | " . $breadcrumb->last();echo $page_title;?>

Link to comment
Share on other sites

ya breadcrump holds the page title i had given you the code before (at the bottom of this page). in that the category name was made page header not page title.(hope you saw my site) what i want is page title, i want page title for every page, but since category string dont allow to make page titles. but i do know that every page has this thing in it, this code in the bold. navbar_title, so can you do something to make the page title look in to navbar of all pages and then select the page titlethis is my privacy.php age

<?php/*  $Id: privacy.php,v 1.4 2002/11/19 01:48:08 dgw_ Exp $  osCommerce, Open Source E-Commerce Solutions  http://www.oscommerce.com  Copyright © 2002 osCommerce  Released under the GNU General Public License*/define('NAVBAR_TITLE', 'Privacy Notice');define('HEADING_TITLE', 'Privacy Notice');define('TEXT_INFORMATION', 'This is our Privacy Notice.');?>
go to includes/classes/breadcrumb.php and look for class breadcrumb {var $_trail;function breadcrumb() {$this->reset();}Change to:class breadcrumb {var $_trail;function last() {$trail_size = sizeof($this->_trail);return $this->_trail[$trail_size-1]['title'] ;}function breadcrumb() {$this->reset();}now go to Directory: includes/languages/english/index.phpand Around Line 19:define('HEADING_TITLE', 'Let\'s See What We Have Here');Alter to:define('HEADING_TITLE', $breadcrumb->last());Around Line 39:define('HEADING_TITLE', 'Categories');Alter to:define('HEADING_TITLE', $breadcrumb->last() . ' ' . 'Categories');
Link to comment
Share on other sites

I've been trying to explain how to do this.Look at the source of your HTML page (from the browser). At the top, you see this:

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html dir="LTR" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Bhura Tea</title>

There is a <title> tag there. I assume that is what you are trying to change, so instead of saying <title>Bhura Tea</title>, you want it to say <title>Bhura Tea - Tea Bags</title> or whatever. You need to find where the <title> tag is being created. If I had all of source code I could find it, but you copy and paste various lines and things that don't show me where in the code this is, so you need to find it yourself. Find where the <title> tag gets printed, and instead of whatever it says now (something like <?php echo TITLE; ?> like you pasted below), you want it to say something like <?php echo TITLE . " " . NAVBAR_TITLE; ?> or something like that. That's what I was trying to say in my last post.

Link to comment
Share on other sites

i try to find my self, but can you give some idea or hint, where it might be, i will give you whatever codes you require. try to see if you can do something. one more thing, as i said, the title for every page is default, it is set by me in the admin control area, so that means that this <?php echo TITLE; ?> or something like that is coming from my admin files. should i look there

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...