Array Block
Permalink
Hi,
I need to put my images below into an array and save it as a variable.
Can any one show me any guidance please..?
Thanks
I need to put my images below into an array and save it as a variable.
Can any one show me any guidance please..?
Thanks
Excellent.
I need to output the array in the <head> , so can I use the variable $images to do this..?
I need to output the array in the <head> , so can I use the variable $images to do this..?
Sorry in the header
I do not know totally what you are trying to do,do you want to do this then:
foreach($images as $image) { echo '<img src="'.$image->src.'"/>'; }
Are you trying to save this in the database between page loads?
No, I need to force it into the header and output the array in a JavaScript snipped in the head of the document. I can do it with cold fusion bug am unsure if this is schievable with php
Ahhh... Ok still a little blurry but I think we're getting closer to understanding each other.
Are you creating a "Block" as it's called in Concrete5?
If so you can do this in your controller.php
Still might not be completely sure what you are asking. Hopefully that helps a bit.
Are you creating a "Block" as it's called in Concrete5?
If so you can do this in your controller.php
// in controller.php // on_page_view gets called when someone views // the page. You can't put this in view() because // it gets called after the head of the document is // written public function on_page_view() { // I'm still not quite sure where you are // getting these values from. // if it's from the blocks db table then // you could do this. $images = array(); // since we are in the controller not the view // we use $this $images[] = $this->field_1_image; $images[] = $$this->field_2_image;
Viewing 15 lines of 21 lines. View entire code block.
Still might not be completely sure what you are asking. Hopefully that helps a bit.
?
its in an array with the variable $images