alfonso
Posts: 121
|
| Posted: 05/31/2008, 4:10 AM |
|
In codecharge 2.0 I write in before show custom code to write in a field called photo the word "archive.jpg" when this field is empty.
if fldphoto="" then
fldphoto="archivo.jpg"
end if
How can I do it in Codecharge Studio 4 and PHP? Where?
Thanks
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 05/31/2008, 5:03 AM |
|
Same place, BeforeShow of the 'control'
if ( $Component->GetValue()=="") {
$Component->SetValue("any new string here")
}
suggested reading: Help or docs subject: Referencing Objects
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
alfonso
Posts: 121
|
| Posted: 06/02/2008, 3:15 AM |
|
Sorry. This code gets error:
Parse error: syntax error, unexpected '}' in /var/www/vhosts/classicoalmazan.com/httpdocs/articulos_events.php on line 30
What I do is to select photo, then I clic in Events -> Server ->Before Show->Custom code.
Any new idea?
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 06/02/2008, 3:28 AM |
|
The event is ok.
Your original code
if fldphoto="" then
fldphoto="archivo.jpg"
end if
is not PhP syntax correct
if ( $Component->GetValue()=="" ) {
$Component->SetValue("archivo.jpg")
}
Is syntax correct for PhP, afaic
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
alfonso
Posts: 121
|
| Posted: 06/02/2008, 3:59 AM |
|
I now my old code was asp.
What I try to tell you is that I put this code:
if ( $Component->GetValue()=="" ) {
$Component->SetValue("archivo.jpg")
}
But I get error I wrote:
Parse error: syntax error, unexpected '}' in /var/www/vhosts/classicoalmazan.com/httpdocs/articulos_events.php on line 30
What I do is to select photo, then I clic in Events -> Server ->Before Show->Custom code. Is this the correct method to write this code?
|
 |
 |
wkempees
|
| Posted: 06/02/2008, 4:16 AM |
|
Yes it is, if you are doing this in a RecordForm.
"alfonso" <alfonso@forum.codecharge> schreef in bericht
news:24843d288d4e62@news.codecharge.com...
>I now my old code was asp.
>
> What I try to tell you is that I put this code:
> if ( $Component->GetValue()=="" ) {
> $Component->SetValue("archivo.jpg")
> }
>
> But I get error I wrote:
> Parse error: syntax error, unexpected '}' in
> /var/www/vhosts/classicoalmazan.com/httpdocs/articulos_events.php on line
> 30
>
> What I do is to select photo, then I clic in Events -> Server ->Before
> Show->Custom code. Is this the correct method to write this code?
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
wkempees
|
| Posted: 06/02/2008, 4:17 AM |
|
Sorry just noticed:
if ( $Component->GetValue()=="" ) {
$Component->SetValue("archivo.jpg") ; //<- add semicolon here
}
Blind morning eyes, sorry
Walter
"alfonso" <alfonso@forum.codecharge> schreef in bericht
news:24843d288d4e62@news.codecharge.com...
>I now my old code was asp.
>
> What I try to tell you is that I put this code:
> if ( $Component->GetValue()=="" ) {
> $Component->SetValue("archivo.jpg")
> }
>
> But I get error I wrote:
> Parse error: syntax error, unexpected '}' in
> /var/www/vhosts/classicoalmazan.com/httpdocs/articulos_events.php on line
> 30
>
> What I do is to select photo, then I clic in Events -> Server ->Before
> Show->Custom code. Is this the correct method to write this code?
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
alfonso
Posts: 121
|
| Posted: 06/02/2008, 4:31 AM |
|
Now I get other error:
Fatal error: Call to a member function on a non-object in /var/www/vhosts/classicoalmazan.com/httpdocs/articulos_events.php on line 31
I replace Component by the name of the component called "foto1":
if ( $foto1->GetValue()=="" ) {
$foto1->SetValue("classico1.jpg");
}
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 06/02/2008, 4:35 AM |
|
Why did you do that?
Undo that and read the Help topic 'Referencing Objects'
If in the BeforeShow event of foto1 label, then $Component refers to foto1.
If in BeforeShow of the Form $Component->foto1->GetValue()
and so on.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
alfonso
Posts: 121
|
| Posted: 06/02/2008, 5:01 AM |
|
I'm stupid. Sorry. It is ok now. As I was using many years codecharge 2.0 and ASP I don't well how to use codecharge studio 4.0. I'm learning many questions with your help.
Solved
|
 |
 |