NerishaB
Posts: 25
|
| Posted: 09/20/2010, 6:47 AM |
|
Hi,
I want to dynamically set the page title from names in the database. For instance, I have several customers and want each page to have the customers name in from of it. For instance, it now displays "Status.php", would like it to say, "<CustomerName> Status.php". Can anyone help me do this?
|
 |
 |
datadoit
|
| Posted: 09/20/2010, 10:13 AM |
|
Between your title opening and closing tags, place a label component or
object.
<title>{Label1}</title>
Then in Label1's BeforeShow event, choose the DLookup action to assign a
value to it.
|
|
|
 |
NerishaB
Posts: 25
|
| Posted: 09/20/2010, 10:13 PM |
|
Thank you, I tried that, but somehow, I am doing something wrong. I put this code in the "Before Show event of the page:
$username = "rootech";
$password = "112234";
$database = "tech_test";
$cn = mysql_connect('localhost', $username, $password) or die("Cannot Connect to Databse Server !!! Find the errors below : <br/>".mysql_error());
mysql_select_db($database,$cn) or die("Cannot Connect to Databse !!! Find the errors below : <br/>".mysql_error());
$query = "SELECT OrgShortName
FROM Globals
WHERE GlobalID = 1";
$DBTitle=mysql_query($query,$cn) or die("Query Failed !!! Find the errors below : <br/>".mysql_error());
$rowset = mysql_fetch_array($DBTitle);
$title = $rowset['OrgShortName'];
mysql_close();
And on the HTML page I have this: <title><?php echo $title;?></title>
|
 |
 |
datadoit
|
| Posted: 09/21/2010, 5:37 AM |
|
1. On your page, switch to HTML view. Place your cursor after the
<title> tag. From the Toolbox, choose the Forms tab, then choose the
Add Label button. That will place the label for you.
2. Choose the label, then in the Properties for the label, choose the
Events tab, then select Server -> Before Show, then click the + button,
and choose Add Action. A popup will display, choose DLookup.
3. For the DLookup properties, set the following:
Expression: "OrgShortName"
Domain: "Globals"
Criteria: "GlobalID=1"
Connection: Connection1
Convert result to: Text
Type of Target: Control
Target: Label1
Replace Connection1 and Label1 with the actual names of your project's
connection and your label, respectively. You are highly encouraged to
take a day or two and go through as many of the available tutorials
included in the help files to fully understand how CodeCharge works.
In a nutshell, it generates the code for you so you don't have to.
"Rapid Application Development".
Enjoy.
|
|
|
 |
|