/    Sign up×
Community /Pin to ProfileBookmark

Dynamic product page

Hi everyone.

I have static html pages with a variety of product thumbnails.

When a user clicks on it, a dynamically created page should open containing the following:
– A larger image
– The product name
– The price
– A link that opens a new window with the product name
– A link that takes the user to a secure checkout page
– A bookmark link that bookmarks this dynamic page
– An “email to friend” link that emails the URL of the page

I am familiar with creating each of the 4 links I listed above.

Basically it’s a question of how to assign a product ID to the thumbnail, and then when the product thumbnail is clicked, the ID is passed on to a dynamic page where the variables and links are populated depending on the ID.

Can I use an arrary of product IDs, with each record containing variables such as “image src”, “name”, “price”, “new_window_link”, “checkout_link”, “bookmark_link” & “email_link”?

So when the ID is passed on to the dynamic page, the array is searched, and each of these variables are outputted.

Thanks in advance.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@violent_jApr 27.2004 — i've written a function to accomplish this kind of things, it depends on a class: class.FastTemplate.php3

class.FastTemplate.php3 is a (very) fast template system

the function is well commented so i hope you can use it at once

[code=php]function SpitOutTpl ($templatename, $vars = "", $return = FALSE) {
/*******************************
Author: D. Haarbrink
Written: 2004-03-02
Last update: 2004-03-22

Arguments:
$templatename -> Filename of the template
$vars -> Array of values with keys defined as template variables
` $return -> Whether to return or printout the parsed template
*******************************/

// Create template object
$template = new FastTemplate($_CONFIG["abs_path"] . "templates"); // Set this to the folder where you store your templates

// Put all templates in an array
$templates["template"] = $templatename;

// Define the array of templates
$template->define($templates);


// Use settype() because variables past to a function are not
// automatically defined as an array
settype ($vars, "array");

foreach ($vars as $key => $value) {

// Assign all vars to their values
$template->assign ($key, $vars[$key]);

}

// Parse the template
$template->parse("OUTPUT", "template");

// Get the contents of the parsed template
ob_start ();

$template->FastPrint ("OUTPUT");

$retVal = ob_get_contents ();

ob_end_clean ();

// Empty the $template object
$template = "";

if ($return) {

return $retVal;

} else {

echo $retVal;

}

} // End function SpitOutTpl[/code]


you have to remove the .txt extension from the attached file, and include this script into the page you use the function

good luck

grtz

[upl-file uuid=ef55b601-164a-4ec7-98eb-2cffd248e471 size=21kB]class.fasttemplate.php3.txt[/upl-file]
Copy linkTweet thisAlerts:
@VikashauthorApr 28.2004 — Thanks, i'll try it
×

Success!

Help @Vikash spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...