CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Dynamic Style problem (RESOLVED)

Print topic Send  topic

Author Message
saseow

Posts: 744
Posted: 03/15/2011, 12:41 AM

I cannot get a page style to change dynamically depending on the value passed via the URL.
This is what I have done:
1) In project settings I have added a new style and checked the 'Dynamically modify Styles" box.
2) In 'Advanced' tab I have left the default values of 'style'
3) created a new page and the html looks correct with this line:
<link rel="stylesheet" type="text/css" href="Styles/{CCS_Style}/Style_doctype.css">

I call the page with the following parameter which is the name of the style: a.php?style=sd
Now, if I have a look at the source for the test page the line is now:
<link rel="stylesheet" type="text/css" href="Styles/seedetails/Style_doctype.css">
and seedetails is the name of the project, not the parameter value for style.

Any ideas what the problem could be?
Thanks!
View profile  Send private message
saseow

Posts: 744
Posted: 03/15/2011, 12:54 AM

This is so weird:
If I change the name of the template variable from CCS_Style to S_Style as an example, and then put this code in the BeforeShow event it works fine:

$mystyle= CCGetParam("style");
global $Tpl;
$Tpl->SetVar("S_Style",$mystyle);

I would have thought that CCS would do this automatically.

Am I missing something here?

View profile  Send private message
damian

Posts: 838
Posted: 03/15/2011, 5:00 AM

try setting a labels value as CCS_Style and see if it has a value?

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
saseow

Posts: 744
Posted: 03/15/2011, 6:33 AM

Hi damian,

Nope, no value for the label. It seems to me as though CCS is not using it's inbuilt function for CCS_Style. I just don't know.
Thanks for the reply.
View profile  Send private message
datadoit
Posted: 03/15/2011, 8:33 AM

Make sure you're publishing everything (F9). If you've edited
Common.php directly at any point, your new settings may not be written
to the file.

Specifically, you should have CCSelectProjectStyle() and
CCSetProjectStyle() functions in your Common.php file.
saseow

Posts: 744
Posted: 03/15/2011, 9:52 AM

Thanks for the reply Datadoit,

Project is being published in total.
I have not edited Common.php at all.
CCSelectProjectStyle() is in the file but CCSetProjectStyle() is not!!

This is an old project that I am trying to change. Could that perhaps be the hassle? If you think it is, could you send me the missing function and I will edit the Common.php file?

Thanks,
Trevor
View profile  Send private message
saseow

Posts: 744
Posted: 03/15/2011, 9:58 AM

Sorry Datadoit, let me amend that:

CCSetProjectStyle() is in the Common.php file.
View profile  Send private message
datadoit
Posted: 03/15/2011, 9:59 AM

//CCSelectProjectStyle @0-F430A08A
function CCSelectProjectStyle() {
global $CCProjectStyle;
$QueryStyle = CCGetFromGet("style");
if ($QueryStyle) {
CCSetProjectStyle($QueryStyle);
CCSetSession("style", $CCProjectStyle);
return;;

}
if (CCSetProjectStyle(CCGetSession("style")))
return;
}
//End CCSelectProjectStyle

//CCSetProjectStyle @0-E7A8832F
function CCSetProjectStyle($NewStyle) {
global $CCProjectStyle;
$NewStyle = trim($NewStyle);
if ($NewStyle && file_exists(RelativePath . "/Styles/" . $NewStyle
.. "/Style.css")) {
$CCProjectStyle = $NewStyle;
return true;
}
return false;
}
//End CCSetProjectStyle


As you can see, CCSetProjectStyle() is called from
CCSelectProjectStyle(), so they are dependent upon each other to work
properly.

I suggest you completely delete the Common.php file, then open up
CodeCharge and go to Property Settings, change anything, then save out.
You should now have a completely new Common.php file, and see if the
functions are in there.
saseow

Posts: 744
Posted: 03/15/2011, 10:44 AM

Thanks datadoit, sounds like a plan.

I will do this early tomorrow morning and post the results here.

Thanks again!
View profile  Send private message
saseow

Posts: 744
Posted: 03/15/2011, 7:53 PM

Thank you datadoit!

I regenerated the Common.php file and all the functions are now there and the style selection works as it should.

Thanks again!
View profile  Send private message
datadoit
Posted: 03/16/2011, 6:46 AM

That's just one of those CCS "thangs". :)
saseow

Posts: 744
Posted: 03/16/2011, 6:54 AM

and so we venture forward ... through the darkness.
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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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