Need Help with a T_ECHO Error
Permalink
Howdy!
Nubby having a syntax error and can't figure out where the problem is located. I created the blocks in the C5 book with no problems. But when I go off on my own, I get the following error:
Parse error: syntax error, unexpected T_ECHO in /Applications/MAMP/htdocs/c5_5521/blocks/store_hours/form_setup_html.php on line 7
Here's the code:
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
echo '<div class="ccm-block-field-group">';
echo $form->label('SunOpen', 'SunOpen:');
echo $form->text('SunOpen', $SunOpen, array('style' => 'width: 200px'));
echo $form->label('SunClose', 'SunClose:');
echo $form->text('SunClose', $SunClose, array('style' => 'width: 200px'));
echo '</div>';
?>
Thoiught I'd see how it looked. The db fields are fairly simple with an Open and Close field for each day. i.e. - SunOpen and SunClose.
Any Help would be greatly appreciated! Jeff.
Nubby having a syntax error and can't figure out where the problem is located. I created the blocks in the C5 book with no problems. But when I go off on my own, I get the following error:
Parse error: syntax error, unexpected T_ECHO in /Applications/MAMP/htdocs/c5_5521/blocks/store_hours/form_setup_html.php on line 7
Here's the code:
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
echo '<div class="ccm-block-field-group">';
echo $form->label('SunOpen', 'SunOpen:');
echo $form->text('SunOpen', $SunOpen, array('style' => 'width: 200px'));
echo $form->label('SunClose', 'SunClose:');
echo $form->text('SunClose', $SunClose, array('style' => 'width: 200px'));
echo '</div>';
?>
Thoiught I'd see how it looked. The db fields are fairly simple with an Open and Close field for each day. i.e. - SunOpen and SunClose.
Any Help would be greatly appreciated! Jeff.
Looks good to me to. Perhaps zip the block up and post it here, or PM me. Let another old (but now Zend Certified) COBOL hacker have a look. We're a dying breed you know!
I did some basic programming on Commodore 64, does that count? :)
I'll see your Commodore 64, and raise you a Sinclair ZX81, built from a kit.
I was only 11...
ok ok you win.
But seriously @Dinosaur
Jero is an engineer and he has some pretty complex add-ons in the marketplace so he probably can find the problem and its solution by the time it takes me to just look at the code...
But anyway, I have some free time and some understanding of C5 so happy to help if needed.
ok ok you win.
But seriously @Dinosaur
Jero is an engineer and he has some pretty complex add-ons in the marketplace so he probably can find the problem and its solution by the time it takes me to just look at the code...
But anyway, I have some free time and some understanding of C5 so happy to help if needed.
Howdy mnakalay & jero!
I sure appreciate the help! I should also mention that I had to recover the files as my mac , lost power friday night during a bad thunderstorm. So I thought maybe it had control characters and looked like a COMP-3 packed field and I just wasn't seeing it. I have zipped up and attached the the entire block for you're perusal. I have even put each line in comments and it only works with an `echo 'Hello World';`. I'm wondering if it isn't coming from the controller, but I'm just starting to get how C5 works. My Son and his wife are opening a business and I was going to create their website and add the store hours block, instead of hard coding them into a table. I also noticed that there isn't a block for it in the marketplace. So once it was working to my satisfaction, I was going to submit it to the marketplace as a freebie add-on.
As far as computers go: My first was a Timex-Sinclair 1500 with 16 KB of RAM!! I thought I died and went to heaven when I bought a TRS-80 with 128 KB RAM, 2 5.25" floppy drives and later added a 8" 5mb hard drive. I could go eat dinner or watch a 30 minutes show on TV and my mortgage calculator and amortization program that I had wrote would just be finishing!! I think the hard drive cost around $900; less than a iPad3! LOL!
Thanks for Your Help!! Jeff.
PS - I'm not Zend certified in COBOL either; in fact I didn't even know you could get a cert. for COBOL. But if they need one now they're just plain SOL!! I'll make the trip to the tar pits smoking a Montecristo stogie as I wade in! I here it's nice there this time of year! ;)
I sure appreciate the help! I should also mention that I had to recover the files as my mac , lost power friday night during a bad thunderstorm. So I thought maybe it had control characters and looked like a COMP-3 packed field and I just wasn't seeing it. I have zipped up and attached the the entire block for you're perusal. I have even put each line in comments and it only works with an `echo 'Hello World';`. I'm wondering if it isn't coming from the controller, but I'm just starting to get how C5 works. My Son and his wife are opening a business and I was going to create their website and add the store hours block, instead of hard coding them into a table. I also noticed that there isn't a block for it in the marketplace. So once it was working to my satisfaction, I was going to submit it to the marketplace as a freebie add-on.
As far as computers go: My first was a Timex-Sinclair 1500 with 16 KB of RAM!! I thought I died and went to heaven when I bought a TRS-80 with 128 KB RAM, 2 5.25" floppy drives and later added a 8" 5mb hard drive. I could go eat dinner or watch a 30 minutes show on TV and my mortgage calculator and amortization program that I had wrote would just be finishing!! I think the hard drive cost around $900; less than a iPad3! LOL!
Thanks for Your Help!! Jeff.
PS - I'm not Zend certified in COBOL either; in fact I didn't even know you could get a cert. for COBOL. But if they need one now they're just plain SOL!! I'll make the trip to the tar pits smoking a Montecristo stogie as I wade in! I here it's nice there this time of year! ;)
The first thing I see is that you don't have all the files in your add-on so it's not possible to install it. The main controller is not there as well as the blocks folder.
The only other thing I can think of is that the variables $sunopen and $sunclose are not defined and don't contain any value. Technically it should not be a problem but I can't see anything wrong other than that.
For instance, in the controller, you have this line:
That line defines the variable $bID that you can use in your form_setup.
You should do the same with the other variables.
Also, in form_setup they are $sunopen and $sunclose while in the view they are $SunOpen $SunClose
I don't know if that will help or not.
Good luck
The only other thing I can think of is that the variables $sunopen and $sunclose are not defined and don't contain any value. Technically it should not be a problem but I can't see anything wrong other than that.
For instance, in the controller, you have this line:
$this->set('bID', $this->bID);
That line defines the variable $bID that you can use in your form_setup.
You should do the same with the other variables.
Also, in form_setup they are $sunopen and $sunclose while in the view they are $SunOpen $SunClose
I don't know if that will help or not.
Good luck
16K? Man, you had so much. The ZX81 came with 1K as standard!
The weird thing is I still had the ZX81 until 3 years ago, when I moved to NZ and sold it on eBay. Got £30 for it, which was roughly half what I paid for it.
I think the problem with your file, is as you suggested that you have some sort of non-printable characters at the end of lines. Not sure if it's COMP-3, maybe COMP-1 ;)
Not sure how they got there, but removing fixes the parse error, but it doesn't seem to save. I think this is because in your form you're using a label of "sunopen", which doesn't match the "SunOpen" you've declared in the db.xml.
To be honest, you might want to consider using the designer content addon, which will do pretty much what you want.http://www.concrete5.org/marketplace/addons/designer-content/...
STOP RUN.
The weird thing is I still had the ZX81 until 3 years ago, when I moved to NZ and sold it on eBay. Got £30 for it, which was roughly half what I paid for it.
I think the problem with your file, is as you suggested that you have some sort of non-printable characters at the end of lines. Not sure if it's COMP-3, maybe COMP-1 ;)
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); // echo "<div class='ccm-block-field-group'>"; echo $form->label('sunopen', 'SunOpen:'); echo $form->text('sunopen', $sunopen, array('style' => 'width: 200px')); <======================= echo ' '; echo $form->label('sunclose', 'SunClose:'); echo $form->text('sunclose', $sunclose, array('style' => 'width: 200px')); // echo "</div>"; <====================== // echo 'Hello World!'; ?>
Not sure how they got there, but removing fixes the parse error, but it doesn't seem to save. I think this is because in your form you're using a label of "sunopen", which doesn't match the "SunOpen" you've declared in the db.xml.
To be honest, you might want to consider using the designer content addon, which will do pretty much what you want.http://www.concrete5.org/marketplace/addons/designer-content/...
STOP RUN.
You are Correct Sir! Thank You!
When I try and add the 'Designer Content' block it doesn't appear. I have to try and download the tarball. Or maybe I need to add the following snippet:
D'oh! After the posting it appears the comment doesn't appear at character position 7.
Think that will work? If I'm ever down your way I'll buy you a pint (or two)!
Thanx, Jeff.
When I try and add the 'Designer Content' block it doesn't appear. I have to try and download the tarball. Or maybe I need to add the following snippet:
* Load the Designer Content Add-on Copybook. COPY YCDESCON.
D'oh! After the posting it appears the comment doesn't appear at character position 7.
Think that will work? If I'm ever down your way I'll buy you a pint (or two)!
Thanx, Jeff.
Download the zip file, unzip into and upload it into the packages folder, then got to the dashboard -> extend concrete5 and you should see it ready to install.
But the best way is to connect your site to the community, using your C5 login - then you should be able to install it from the dashboard.
It's a long way down here, and the beer is rank, so bring your own :)
But the best way is to connect your site to the community, using your C5 login - then you should be able to install it from the dashboard.
It's a long way down here, and the beer is rank, so bring your own :)
Could you share more of it, the problem must be somewhere else.