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 -> PHP

 Conditionaly run HTML block (Resolved)

Print topic Send  topic

Author Message
saseow

Posts: 744
Posted: 06/30/2011, 11:08 AM

I have an HTML block:

<style>
body {
background: #FFFFFF;
}
</style>

Is it possible to only run this if a parameter is true? e.g.

if (CCGetParam("ViewMode") == "Print")
":then run this block"

Can be done or not?
View profile  Send private message
datadoit
Posted: 06/30/2011, 11:14 AM

I would dynamically modify the style of the element based on the condition.

HTML:
<div class="{MyStyle}">

PHP:
global $Tpl;
if (this) {
$Tpl->SetVar("MyStyle", "ThisClass");
}
else {
$Tpl->SetVar("MyStyle", "ThatClass");
}

Keep your styles in a stylesheet. CodeCharge pukes hard when attempting
to put a <style> block in the <head> section.
saseow

Posts: 744
Posted: 06/30/2011, 11:19 AM

Very interesting datadoit. Thank you.

I will give this a try. Will have to find the style sheet first as this is my maiden voyage into Artisteer. Working very well so far!

I will post result here.

Thanks again.
View profile  Send private message
saseow

Posts: 744
Posted: 06/30/2011, 11:35 AM

datadoit....Brilliant!
The solution:
HTML:
{tcr_bg}

PHP:
global $Tpl;
if (CCGetParam("ViewMode") == "Print") {
$Tpl->SetVar("tcr_bg", "<style><!--body {background: #FFFFFF;}</style>");
}

Works like a dream. Thank you!
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.