RoyHobbs
Posts: 3
|
| Posted: 08/22/2007, 12:04 PM |
|
Greetings!
I am trying to make the META TAGS in the <head> of my page be relative to table data on the page and cannot make it work.
I found this thread which was helpful - http://forums.codecharge.com/posts.php?post_id=72791
but it is for PHP and I am unable to make it work with ASP.
Can anyone provide help on how to have the meta tags (title,description,keywords) be assigned by table data using ASP?
Thank you.
|
 |
 |
wkempees
|
| Posted: 08/22/2007, 12:12 PM |
|
Search helpfile for 'Component attributes'
Then after understanding how to use those
you can simply put an attribute in the HTML at the appropriate place
and fill that from within you asp source code, f.i. before show of the page
or after initialize
Whatever fits your needs.
Walter
|
|
|
 |
RoyHobbs
Posts: 3
|
| Posted: 08/22/2007, 12:39 PM |
|
Thanks!
I have read that section of the Help and understand adding an attribute to the HTML using the Insert Attribute rt-click.
I can add the attribute: {page:alxtitle} between the <title> heads. Am I correct in assuming the Source Type and Source Name for this attribute are both blank?
Then I add a Before Show event (Action or Code?)
If Action - which one?
If Code - I need help with the exact asp code needed to pull data from table:ITEM field:DESCRIPTION and insert it as the title of the page. f.i. is this correct code??
$Component->Attributes->SetValue('alxtitle', '{ITEM:DESCRIPTION}');
or is the above wrong? I get the concept, but need specific assistance defining the step by step how to.
Thanks.
|
 |
 |
wkempees
|
| Posted: 08/22/2007, 2:09 PM |
|
Open the Page in HTML mode.
Between the <title></title> I would insert
<META name="keywords" content="{page:alxtitle}" />
using the Insert Attribute rt-click to add the attribute.
You are correct in assuming the Source Type and Source Name for this
attribute are both blank.
In Page Before Show event CODE
you could the start building the list of keywords that would have to be
separated by commas, like
(PhP:)
$Component->Attributes->SetValue('alxtitle','key1, key2');
However, building it dynamically from within f.i. a grid involves addressing
a Page:attribute from
within a Grid. I was not able to do that (yet).
So in Page Before Show I would do a lookup of the wanted values build the
string and assign it.
You will have to apply the ASP yourself.
Walter
|
|
|
 |
andrewi
Posts: 162
|
| Posted: 09/12/2007, 1:39 PM |
|
Here is one possible solution in ASP
1. - Insert attribute into page title. (Rt-click, Insert Attribute. Leaving Source Type and Source Name blank, as discussed)
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>{page:pagetitle}</title>
<meta content="CodeCharge Studio 3.1.1.0" name="GENERATOR">
2. Insert following code into Page Before Show event:
Function Page_BeforeShow(Sender) 'Page_BeforeShow @1-A1547E8B
'Custom Code @19-73254650
' -------------------------
Attributes("pagetitle") = "this is the page title"
' -------------------------
'End Custom Code
End Function 'Close Page_BeforeShow @1-54C34B28
That works for me. For further investigation: what event to use if you want to take data from the database (from a form's recordset, say) and show in the title.
|
 |
 |
RoyHobbs
Posts: 3
|
| Posted: 09/12/2007, 3:11 PM |
|
Thank you. That helps make things more clear.
In your step #2 you have:
Function Page_BeforeShow(Sender) 'Page_BeforeShow @1-A1547E8B
'Custom Code @19-73254650
' -------------------------
Attributes("pagetitle") = "this is the page title"
' -------------------------
'End Custom Code
End Function 'Close Page_BeforeShow @1-54C34B28
What if I want data from a table instead of text reading "this is the page title" ??
Thanks again.
|
 |
 |
Oper
Posts: 1195
|
| Posted: 09/12/2007, 6:51 PM |
|
Function Page_BeforeShow(Sender) 'Page_BeforeShow @1-A1547E8B
'Custom Code @19-73254650
' -------------------------
Attributes("pagetitle") = ccdlookup("field","Table","Condition",Connection)
' -------------------------
'End Custom Code
End Function 'Close Page_BeforeShow @1-54C34B28
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |