CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 programmable background

Print topic Send  topic

Author Message
sewells

Posts: 13
Posted: 06/12/2004, 6:27 PM

Hello,

I'd like to adjust the background of a page from an entry in a database, I tried editing the HTML, but this didn't work

<body bgcolor="<%=CCDLookup("C_Sub", "Config", "C_Match = '\{bgcolor\}'",DBdwp2)%>">

Any thoughts?

Regards
View profile  Send private message
BlinkyBill

Posts: 86
Posted: 06/13/2004, 2:35 AM

Quote sewells:
I'd like to adjust the background of a page from an entry in a database, I tried editing the HTML, but this didn't work

<body bgcolor="<%=CCDLookup("C_Sub", "Config", "C_Match = '\{bgcolor\}'",DBdwp2)%>">


This won't work, as you already worked out :) The reason *why* it doesn't work is because CCS produced ASP code is templated. When you deploy your web site there is a *.html file and a *.asp file the *.html is read in by the *.asp file the template blocks are parsed and then rendered. Now the answer to you question is by using *template* blocks.

Look under Help .. Examples and Techniques .. Programming .. Working with Pages. There are quite a few very well documented samples of how to do this.

Just as a side comment, I find working with the templated ASP pages MUCH MUCH better then the classic ASP inline methods.
View profile  Send private message
sewells

Posts: 13
Posted: 06/13/2004, 8:35 AM

I did get it working, thanks. The help was less ideally written, but with some work here is what I ended up having:

HTML:
<!-- BEGIN MyBody -->
<body bgcolor="{bgcolor}">
<!-- END MyBody -->

ASP:
Function Page_BeforeShow() 'Page_BeforeShow @1-653D685B
Dim CustomBlock
Set CustomBlock = Tpl.Block("MyBody")
CustomBlock.Variable("bgcolor") = CCDLookup("C_Sub", "Config", "C_Match = 'topbgcolor'",DBdwp2)
CustomBlock.Parse ccsParseAccumulate

'End Custom Code
View profile  Send private message
BlinkyBill

Posts: 86
Posted: 06/13/2004, 2:06 PM

While on this topic I use antoher method. I didn't suggest it as it may not be the "correct" way of achieving this . It works fine for me so YMMV.

1. Put a label control anywhere on the page.
2. cut and paste the label control to where you really want it. In my examp I wanted a custom title tag. eg:
<title>{CustomTitle}</title>
3. Then on Page_Before show set the label eg:
CustomTitle.Value = "My Custom Title"

As you can see way less complicated and less code. Again it was worked perfectly for me, but it's not documented.
View profile  Send private message
peterr


Posts: 5971
Posted: 06/13/2004, 2:17 PM

Hi,

Yes, this is the standard method and is shown in the docs here:
http://docs.codecharge.com/studio/html/ProgrammingTechn...ntrolValue.html
http://docs.codecharge.com/studio/html/Components/RTPro.../ASP/Value.html

While the previous, TPL method at:
http://docs.codecharge.com/studio/html/Components/Varia...MLTemplate.html
http://docs.codecharge.com/studio/html/Components/Variables/ASP/Tpl.html

Both of the above methods are equivalent.
Keep in mind that any Web output usually contains HTML, whether within <title>, <body> or any other tag, or even as an HTML snippet that contains HTML tags. You could even create a custom function that outputs 90% of your page as one Label. The includable pages actually work in a similar way.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.