CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Reassigning Header page

Print topic Send  topic

Author Message
Marc Collins
Posted: 05/06/2002, 9:39 AM

I have a modified YellowPages project.

I have cloned the default and entires and header pages to make two "streams" of entry into the directory. How do I reassign the new header page to the new default page? As it stands, the changed (second stream) pages are OK except that the original header is attached to them. You can see the relationship (the original Header pointing to both the original Default and the new similar page) in the Diagram view quite clearly, but of course cannot change it from there.

Thanks,

Marc
Andrew B
Posted: 05/06/2002, 6:11 PM

Obviously you have created 2 different sets of header/footer pages, so I will skip that. I am also assuming that you have them named different things (ie. yp_header, yp_footer, and info_header, info_footer), which is required for this to work.


1. Go to modules -> global
2. Put two lines like these in that section to redfine which header page to point at :
sHeaderFileName = sAppPath & "reg_header.html"
sFooterFileName = sAppPath & "reg_Footer.html"
3. Regenerate

This should make whatever files are in the that project use those headers, since we have redefined them. 'Globals' go at the bottom of the common.asp, so they should be being re-defined since common.asp is the first included.

Just repeat for the second project, and all should be well.

A note : I did this by going to modules->common, getting generated code, and modifying it there. I did this because I also had to modify the behavior of toSql(), but this should work just as well.
Marc Collins
Posted: 05/07/2002, 10:39 AM

Yes, I have two header pages.

I see the line in the common code you are referring to. But I have two streams of pages in the SAME project.

I need to make sure default1 is using header1 and default2 is using header2. Right now they both use header1 because default2 was created by "copying a similar" page from default1. I have changed all the database values appropriately, but could not figure out how or where to change the header page.

You have shown me where it is!! Thanks. But how can we assign different headers to different pages? If I change or add to the common/global code, won't it just reverse the situation and both default1 and default2 will then use header2 as the Header?

Thanks,

Marc
Andrew B
Posted: 05/07/2002, 1:00 PM

I spent a while trying to do just what you are talking about, but was unable to get it to work. Here are the reasons I found :

You need to change the header/footer variables before the code CC generateds uses them. The problem is that there is no 'event' that will insert code before the routines are called to load the header/footer.

The header/footer are declared in an include, then the code starts executing (main page). The first event you can use occurs after the calls to loadtemplate have been made for the header/footer pages, but before they are actually rendered, so there is no opportunity to change them.

You can not place code in the custom head section of the page, since that is inserted directly into html, and any code there isn't executed.

There may be a clever way to do this in one project, but I haven't been able to figure it out yet. The only way I can think of doing this is to put a block of code in the globals section that checks which page you are on (via asp's request.servervariables("script_name") i think) and changes headers accodingly. This does force you to specify the file names you want the new header on in the code, but it should work. If you need post again or drop your email.

I solved this by creating two seperate projects and then putting the code to change the header in the 'open any page' section of modules.
Andrew B
Posted: 05/07/2002, 1:11 PM

I think I thought of another way, but it would require putting a function on each and every page.

In the 'open any page' section, call a function called change_headers() that returns a boolean (true/false). If true, change to the new header, if false don't change. You would have to put this function on every page, but it should work.

---- open any page / modules --------
if (change_headers()) then
sHeaderFile = "..."
sFooterFile = "..."
end if

---- page 'open' event --------------
function change_headers()
dim retVal

'if i want to swap the headeers
retVal = true
'if I want to keep then the default
retVal = false


change_headers = retVal
end function

   


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.