Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating new pages from template

Status
Not open for further replies.

movium

Technical User
Feb 18, 2002
14
SE
Hi,
I´m developing a dynamic site for the departement at the university where I work. Until now there has only been minor probs. But now I will have to sink my teeth into the more difficult ones.

We offer a variety of courses at Movium. I have created a template which is supposed to give basic course description to the visitor. I have also created an admin-template that updates the course description. Is there a way to save the info-template in a new name over the web so that each course gets a webpage of its own. Which is the best way to do such an update function?

The image below describes the principle.
scheme.jpg


Regards
Niclas Östlund
 
Hi Niclas,

If you want to have each course with it's own webpage but sharing a common template, I would store the course info in a database and have the template pull the specific course info and display it.

If I understand your question, I think this will do what you want.

<cfquery name=&quot;q1&quot; datasource=&quot;myDs&quot;>
select * from courseInfo
where courseID=#url.courseID#
</cfquery>

<cfoutput>
<html><head><title>#q1.courseName#</title></head>

<body>
#q1.courseName#
<p>
#q1.courseDescription#

</body>
</html>
</cfoutput>

Hope this helps,
GJ
 
Could you explain how this row in the query you suggested works.

where courseID=#url.courseID#

Regards,

Niclas
 
Hey Niclas,

That line is how you would specify which course out of all the ones in your database you want to retrieve and display. The variable #url.courseID# is a URL variable and is passed to the template via the url like this:


In this scenario, your template (if named templatePage.cfm) would be passed a url variable called courseid (#url.courseID#) with a value of 73. The sql query would then look up the course whose id is 73 in your database and display that information.

You can pass the course id through form variables as well but the url approach is probably the most common.

Hope this helps,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top