Results 1 to 16 of 16

Thread: Title of catalog item as <title> tag in detail page

  1. #1
    New user
    Join Date
    11-13-09.
    Posts
    3

    Default Title of catalog item as <title> tag in detail page

    Hi,
    I was wondering if the value of the title field of a catalog item can be set as <title> of the detail page. Thanks for any help!

    Daniel

  2. #2
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Title of catalog item as <title> tag in detail page

    Already available in the catalog Template variable array.

  3. #3
    New user
    Join Date
    11-13-09.
    Posts
    3

    Default Re: Title of catalog item as <title> tag in detail page

    Hy thyon,
    And how can I replace $this->pageTitle in fe_page by this value? Sorry, that's perhaps a stupid question.
    Daniel

  4. #4
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Title of catalog item as <title> tag in detail page

    Ah I misunderstood, in the reader the title is automatically replaced by the title field selected for the catalog, when you edit the catalog (not edit fields)

  5. #5
    New user
    Join Date
    11-13-09.
    Posts
    3

    Default Re: Title of catalog item as <title> tag in detail page

    Now I found the title field selection. It is only available after making the catalog searchable.

    Thanks for your prompt help!
    Daniel

  6. #6
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Title of catalog item as <title> tag in detail page

    I've made them independant in the alpha 2.0 version.

  7. #7
    New user
    Join Date
    12-08-09.
    Posts
    1

    Default Re: Title of catalog item as <title> tag in detail page

    Hi Thyon,

    I also use the catalog extension and it works great, also with multiple languages. But there is one thing that I wonder how to get this:

    How can use the items title for the page title correctly? At the moment I do get the german items title as page title due to the restriction that I use one single catalog and can only determine one field to be used as title. So I have to choose the german one and the english one cannot be selected.

    Is there a way to get this?

    Regards,

    Christian

  8. #8
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Title of catalog item as <title> tag in detail page

    Nope. the selection of the pageTitle is set as a HARD-coded field (one selection). Please submit a feature request for this, and we'll take a look at how to incorporate it.

  9. #9
    New user
    Join Date
    08-04-09.
    Posts
    18

    Default Re: Title of catalog item as <title> tag in detail page

    Hi Tython,

    just wanted to check on the status of this update.

    I think having the ability to apply more than one field to the 'Page title field' would be very useful (maybe in the same way one can create the 'Format title string' one the same page?).

    Additionally the catalog list would be extremely useful (especially for SEO) if when a filter was applied to a catalog list the title would change based on the filter.

    I'm using catalog list a lot and Google Webmaster tools always complains about the duplicate title tags for different list filters which I link to in the main menu (for example in a where to buy list of distributors filtered by country)

    see : http://www.brainboxes.com/where-to-buy/ ... country/GB
    and: http://www.brainboxes.com/where-to-buy/ ... country/IN

    for example of what I mean.

    I think the catalog extension is awesome. thanks for all the hard work.

    If possible and you need I will try to make a patch which will allow this, although I'm not too familiar with the inner workings of typolight and catalog extension

  10. #10
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Title of catalog item as <title> tag in detail page

    I'm not actively developing the catalog anymore, you'll have to ask one of the developers like xtra.

    I'm starting something new, which will work in a completely different way, and therefore completely incompatible with the catalog -- which had numerous problems in its design, hence it's not possible to extend it effectively without a lot of extra work.

    The title is settable PER catalog, which means the title field is used to update the reader page title, this can be a different title field, per catalog (Video Catalog can use Title, Downloads Catalog can use filename, etc.).

    You can also manually update the title by doing this in your template:
    Code:
    <?php
    
    global $objPage;
    $objPage->title = 'Whatever title I like';
    .... template code
    
    ?>
    It should work at Template level, since the template is only parsed at the very last step.

    This means you can also set-up the pageTitle to incorporate any of the Filter commands, e.g.

    Code:
    global $objPage;
    $objPage->title .= ' - filtered by '. $filters;
    You'll have to do some processing on the filters to get to the $filters variable I used.

  11. #11
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Title of catalog item as <title> tag in detail page

    Quote Originally Posted by thyon
    I'm starting something new, which will work in a completely different way, and therefore completely incompatible with the catalog -- which had numerous problems in its design, hence it's not possible to extend it effectively without a lot of extra work.
    Ooooh -- that's very intriguing, Thyon. Could this be the holy grail "module creator" extension? :D
    Brian

  12. #12
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Title of catalog item as <title> tag in detail page

    Almost. I'll give you some more details....

    [attachment=0:3nzu4hgk]large-tree.png[/attachment:3nzu4hgk]
    Tree is the BackEnd Module, it includes: Tree Archives (catalogs), Trees (elements), Branch (display collections), Leaf (list,filter,link,trim,range,dates,sort,search elements).

    There will be a few startup modules to display the contents of a Branch, which can then contain any combination of the leaf elements. So when you've setup the modules, you never have to edit them again. You just go the the BE Branch for the Tree and publish/unpublish the leaf elements to show/hide, or simply drag them up/down to reorder their appearance.

    The structure will be completely modifying by any additional extension. The idea is that people can then product a Property, Store, Gallery, whatever Pack and then add that to the tree, with pre-set palettes, branches, etc.

  13. #13
    New user
    Join Date
    08-04-09.
    Posts
    18

    Default Re: Title of catalog item as <title> tag in detail page

    Fantastic, Thanks for the help here really appreciate it, just what I needed.

    good luck with your new project will try to follow it closely!

  14. #14
    New user
    Join Date
    08-04-09.
    Posts
    18

    Default Re: Title of catalog item as <title> tag in detail page

    To be honest the fix wasn't quite as easy as you said, but you gave me all the right pointers to make it work. (slightly hacky though!)

    Just in case anyone else tries to do this.

    1. Add the following line to your catalog template:
    Code:
    	<?php
    	global $objPage;
    	$objPage->title = "Some new Value you choose";
    	?>
    <-- this doesnt yet fix anything as it seems like the pageTitle has already been written at this point

    2. Create a PHP file which will post process pages to amend the page title:
    Code:
    <?php
    
    class CustomHooks {
    	
    	public function fixPageTitle($strText, $strTemplate){
    		global $objPage;
    		if( $strTemplate != "fe_page") {
    			return $strText;	
    		}
    		return str_replace('####pageTitle####', $objPage->title, $strText);
    	}
    }
    
    ?>
    3. Upload the file to /your/path/system/libraries
    4. Register hook by adding an output hook to /system/config/localconfig.php
    Code:
    $GLOBALS['TL_HOOKS']['outputFrontendTemplate'][] = array('CustomHooks', 'fixPageTitle');
    5. Now you can edit any other template and use the (arbitarily choosen) string ####pageTitle#### . For example in the template file: fe_page.tpl


    This string will get replaced by the new title by the time its output to the user. Otherwise the page will retain its original title.

    Hope this helps someone, i'm sure theres a cleaner way to do it, just not yet familiar enough with typolight

  15. #15
    New user
    Join Date
    08-04-09.
    Posts
    18

    Default Re: Title of catalog item as <title> tag in detail page

    Maybe this will help someone too, if you want to figure out which filters have been selected by the user simply add this to the top of your filter template, (e.g. filter_default.tpl)

    Code:
    <?php 
    $selectedFilters = "";
    
    foreach($this->widgets["filter"] as $widget){ 
    	$options = deserialize($widget["options"]);
    	for ( $i = 1; $i < count($options); $i ++) {
    		$option = $options[$i];
    		if(array_key_exists("selected", $option)){
    			$selectedFilters .= " > ". $widget["label"].": ".$option["label"];
    			 break;
    		}	
    	}
    }
    //assign the selected filters to the pageTitle 
    //(warning this has no effect unless you use something similar to the hack i showed in the previous post
    global $objPage;
    $objPage->title .= $selectedFilters;
    
    ?>

  16. #16
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Title of catalog item as <title> tag in detail page

    Nope. my code works, but what you're forgetting is that the catalog template might not be the only thing that wants access to the title. Also my code is really only for the FILTER and LIST templates, since its not required at READER level, as that is already integrated into the catalog.

    Its also only advisable to add it to the FILTER template, because the list template will be called multiple times, and it will keep overwriting itself.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •