WebsiteBaker Support (2.8.x) > Bakery Shop

Different template for view item

<< < (2/3) > >>

Ruud:
That is what the snippet does.
It creates some standard headers, including <title>Your Bakery itemtitle</title>.
It will also use the short-description field in your bakerypage to fill the meta description tag..

daydreamer:
I can call the item ID with
--- Code: ---<?php echo ITEM_ID; ?>
--- End code ---
but not the item title as these don't work

--- Code: ---<?php echo ITEM_TITLE; ?>
--- End code ---

--- Code: ---<?php echo TITLE; ?>
--- End code ---

Ruud:
No, remember your template index(2).php is loaded before any page_content is loaded.
So the template will never be able to have content or page specific variables when it is being loaded.

The snippet actually does this (the hard way) for you.
It knows about bakery/news/topics etc.. and will find the title before the content requested.

daydreamer:
So there is no way of calling the item title direct in my index2.php

Ruud:
No, not without a call to the database.. (or using the snippet)

A quick oneliner query would be:

--- Code: ---<?php
$item_title = $database->get_one("SELECT `title` FROM ".TABLE_PREFIX."mod_bakery_items WHERE `item_id` = '".ITEM_ID."'");
echo $item_title;
--- End code ---

Does that help?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version