close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to get database to populate page template?

Thread began 7/22/2010 4:41 pm by dev396590 | Last modified 7/23/2010 2:45 pm by dev396590 | 899 views | 7 replies |

dev396590

How to get database to populate page template?

Dear Friends,

Jumping into this project with zero experience and after relatively minor boxing matches with the 'Getting Started' guides, I was able to: create a database, build the admin back-end where the db can be edited (ultimately by the client), create the cart and checkout process with pretty good success. Which may make my question sound lame — but here's where I'm stuck —

I have a series of page templates (built in Dreamweaver CS4) with the necessary fields in editable regions, etc. There are 5 product categories, with about 15 items in each category.

How is the dynamic page (that the Web visitor will see) created from these two elements (the database and the template)?

Apologies for the noob question, but I'm at a loss on how to proceed. Any help or direction would be most appreciated.

Thanks in advance!

p.s. eCart rocks — just built a small static site for a client that works like a charm, but how to get the page template populated from the database is throwing me for a loop. Thanks again!

Sign in to reply to this post

Dani Chankhour

I think what you need to have is for your template to include a left column which have a list of your categories. When a visitor click on one of the categories then you will have a page that filters based on the category selected.

So your page should look similar to what we do in our PowerStore solution pack:

Products_Results.php

Sign in to reply to this post

dev396590

Thanks for your reply, Dani. I actually have the template(s) designed set up to accept info from the database (Item Number, Price, Weight, etc.) along with an image and a short description.

My problem is how to get the data for each product from the database and into my page template. In other words:

• I have a template, from where I save a page as 'productA.php'

• I have a database with 'product A's' infomation.

How do I get the database content for that product into the templated page (for that product.)?

Thanks again!

Sign in to reply to this post

dev396590

Can't find solution in documentation. Need a hand!

Is there another Dreamweaver Extension or Solution I need? Maybe someone from sales can answer?

Thanks in advance!

Sign in to reply to this post

CraigRBeta Tester

What do you have in terms of WA extensions?

there are ways to do this with and without them, but often, asking direct questions with respect to an extension can get meaningful answers more quickly.

As you know, your templates allow you to determine how your page looks, and where the data goes.

In order to display your database information on your template based page, you need to create a connection to your database.

once this is done, you create recordsets, which filter the data from your database, according to the parameters you set.

You can use dreamweaver to display this data, or use dataassist to help make the process a bit easier.

in your scenario, it seems like you want a products page to list your products, which can be filtered by category, depending on the category chosen from the menu.

this would link to a product detail page, depending on the product chosen, where the single product item would be displayed with all relevant images and details. This page is where you would add your add to cart behavior.

I'm pretty sure there are walkthroughs using the blue sky music database as an example, within the ecart dociumentation.

Perhaps a member of the WA team could help you with this

take a look at this thread too... showthread.php?t=7814

Sign in to reply to this post

dev396590

[QUOTE=CraigR;68385]What do you have in terms of WA extensions?

Thanks so much for your time Craig, VERY much appreciated. I actually have the entire extension set under the annual membership.

---

In order to display your database information on your template based page, you need to create a connection to your database.

once this is done, you create recordsets, which filter the data from your database, according to the parameters you set.


Me: The connection and recordsets are good, no problem there...

----

You can use dreamweaver to display this data, or use dataassist to help make the process a bit easier.


Me: Ah, OK here is where I'm stuck. Is it DataAssist that will populate the template? If so, it wasn't clear how to produce say, over 50 pages, of product detail content.

Let's say I have all the recordsets and the template ready. How would I create a page for each product and have the proper fields filled in from the database?

Sorry again if that sounds dumb (I'm still on the learning curve)...

----------


in your scenario, it seems like you want a products page to list your products, which can be filtered by category, depending on the category chosen from the menu.

this would link to a product detail page, depending on the product chosen, where the single product item would be displayed with all relevant images and details. This page is where you would add your add to cart behavior.



Me: How should the product page be created, and where would that reside in the directories? (in terms of coding — in a way it could 'talk to' the individual product detail pages?

-------

Thanks again for your time and assistance, Craig! I feel I'm thisclose to getting this dialed in, maybe with just a few more stupid questions. ;-p Thanks again

Sign in to reply to this post

CraigRBeta Tester

OK. you have your recordsets.

There are many ways of achieving this, both using just dreamweaver and also using dataassist.

Dataassist is useful in a number of ways, especially in creating groups of pages with interrelated data and with some repeating table layouts.

How you approach this depends on how you want to learn, i love the fact that extensions can do a lot for you in just a few clicks, but i find it even more useful if i know what they are doing.

Anyway, lets take a product page for starters, with a recordset from a single table.

create a new page product.php or whatever, based on your template, and place this in the root folder.

Lets say you have a table called tblproducts.

one way to retrieve all the data from this table is SELECT .... FROM tblproducts, where ... is * or a list of field names.

once this is done, you can simply drag the fields you require on your page, from the bindings panel, and drop them on your page.

this will give you (only) the first row from the recordset.

in order to show more rows, you would need to add a repeat region server behavior.

all of this stuff should be in the dreamweaver help files, and it is good practice to understand the principles, so when you analyse the code that dataassist produces, you understand what is going on

using dataassist, this is quite easy.

insert-->Webassist-->DataAssist-->Repeating table.

choose your recorset, number of rows and columns etc, and select the data you want to insert into the table.

Have a play with it and you'll soon get the hang of it.

Once this is done to your satisfaction, create another page for productdetail using the relevant recordset, which would be filtered by the url variable passed from the product page, so only the relevant product detail can be displayed.

if it helps, here is a link to a visual example of something i am working on.

the product page has a recordset filtered, according to the menu item chosen from 'products', which passes a url variable to the page.

the repeating table is a 3x4 table created using the dataassist repeating table wizard.

if you hover over any item , you will see it is a link to the product detail page, with the relevant itemid (and categoryid) passed as a url parameter.

hope this helps

http://www.test.stonepits.com/

click a submenu item under 'products'

Sign in to reply to this post

dev396590

Wow! Thank you!!!

Thanks soooooo much for this, Craig. Can't tell how I appreciate your time and guidance. I'll be digging into this right now and try to bother you unless absolutely necessary. Thanks again!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...