CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 PHP code with CSS

Print topic Send  topic

Author Message
ab4net

Posts: 6
Posted: 11/11/2013, 12:07 PM

:-/
Hi all ...
am new, just bought the CSS ..
i do PHP programing, but a bit rusty ...
if iam creating a form (Record) in the Builders, and i want to add some PHP code,
is there a proper way to add them, or just swich to CODE area and drop the code i want to write ?!
View profile  Send private message
eratech


Posts: 513
Posted: 11/11/2013, 3:15 PM

Hi - That's the way I started using CCS with ASP.NET tutorials and that is the absolute wrong way to do it. If you start editing the CCS pre-built code (has a slightly coloured background) then CCS will consider that part of code 'customised' and will not update it again. That is, you edit part where the data fields have their values set and then add another field - it will not be included in the data setting code.

The CCS handles your code with Server Actions. Almost all the controls, forms, grids, etc have 'Events' and you can put your code into them and CCS will put them in the right places.

For example, if you wanted to add your own code before the data is updated to the database (maybe adding a discount perhaps), you would click on the Record, go to the Properties window, Events, and right-click on the 'Before Update' - the 'Add Action' will show a bunch of useful 'fill in the gaps' pre-made functions for you or 'Add Code' is for your custom code. The + at the top of the Events bit does the same.

CCS will then put it in the right place in the code and you can return there and update what you need. It is one of those times where you need to let CCS do it's bit, and insert your custom parts where you need them.

There are good references in the Help - and I tend to use the built in actions a LOT as it saves work, and I can use the CCS Actions as a guide for my own code (eg: Add an Action, look at code, add Code and do your own then delete the old Action)

Just remember - any Custom Code you put in will not update when CCS is updated, or you change Project languages (eg: PHP to ASP.NET), but most of the Actions will do it automatically.

Sorry for long answer. I should be programming, but you question was more interesting.

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
ab4net

Posts: 6
Posted: 11/11/2013, 11:21 PM

was great answer ... thanks
but if i want to add insert or select query as example ...
how should i connect to the database or how to use there variables ...
if the field name in the form : username ...
shall i use it : $username in my code or form.username or what ..
please advice ..
View profile  Send private message
eratech


Posts: 513
Posted: 11/12/2013, 4:28 PM

Look up the Help for "DLookup" for examples, and search for "Execute Custom SQL" topic (select PHP language at top-right of window). There will be a connection variable that will handle the DB connection. Most of the benefit of CCS is that the framework takes away a lot of the boring copy-paste code for connecting to DBs and updating fields.

Both topics will have examples of PHP variables. CCS pretty much puts some nice wrappers and global variables around so you don't need to reference it from scratch.

eg: some references will be like $record1_username->GetValue() and others will be $Component->username->GetValue() (as $Component is short-hand for the item you are adding the code to. $Container usually refers to the parent Grid or Record)

As I said in the previous answer, what I do with a new language is try adding some 'Actions' to events, like 'Retrieve Value for Control', CCS will create code that you can copy and reuse - it gives you the format of variables and connections etc. Then you can delete the dummy Actions.

Look through the code that is generated to get an understanding of what fields and methods your project is using.

Cheers

E
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
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.