Skip to main content

Changing the page title in multiple places

More
14 years 11 months ago #27471 by bluetonguedesigns
Hi

This seemed to work in the previous version but things must have changed. Originally you said to add this code into the product Show view...

$doc->setTitle('Site Name - Online Store - '.$cat->category_name.' - '.$this->element->product_name);

And in another site I have not updated, that worked fine. I just added it to a new install and it gives an error.

I'd like to have that in the page view and in the category view (Minus the product name)

If I could also "pickup" the site name from the Joomla system that would be great instead of manually adding it into the pages would be great.

Is there any chance in an update we could get more control over what is displayed as the browser page title etc? I think it would be a popular addition to the system.

Cheers

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #27477 by nicolas
Hi,

The modification didn't change. However, there was not only that line.
Also, you didn't give the error message, so hard to say what is the problem...

There is already a lot of options. Adding more options to control dynamically the title is not something I think is relevant to most uses and will clutter the configuration.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #27482 by bluetonguedesigns
Hi Nicolas

Thanks for the reply.

Here is the original code I used and what came before it...

<div id="hikashop_product_left_part" class="hikashop_product_left_part">
<div id="hikashop_product_image_main" >
<div id="hikashop_main_image_div">
<?php
$doc =& JFactory::getDocument();
$class = hikashop::get('class.category');
$cat = $class->get($this->element->category_id);

$doc->setTitle('Shop Name- '.$cat->category_name.' - '.$this->element->product_name);

I can find the 3 <Divs> like above in the view file but the other php that comes after it in red is quite different in this view I have here.

<div id="hikashop_product_left_part" class="hikashop_product_left_part">
<div id="hikashop_product_image_main" >
<div id="hikashop_main_image_div" class="hikashop_main_image_div">
<?php

if(!empty($this->element->images)){
$image = reset($this->element->images);
if(!$this->config->get('thumbnail')){
echo '<img src="'.$this->image->uploadFolder_url.$image->file_path.'" alt="'.$image->file_name.'" id="hikashop_main_image" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle" />';

and so on...

The error is...

Cleansing Milk - 200ml Cleansing_Milk_-_200ml
{hikashop_social}

Fatal error: Call to a member function setTitle() on a non-object in /home/moonlady/public_html/templates/moonlady_11/html/com_hikashop/product/show.php on line 43


I inserted the line straight after the opening <?php tag

Cheers

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #27493 by nicolas
That error means that $doc is not set before you use the get method on it with the line $doc->get...
That means that you don't have the line $doc =& JFactory::getDocument(); before. Please check on that.

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #27558 by bluetonguedesigns
Hi Nicolas

Many thanks, I modified the Category view as well and all works perfectly.

Please Log in or Create an account to join the conversation.

Time to create page: 0.167 seconds
Powered by Kunena Forum