Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
May 28, 20159 yr Tryign to add a bit of php to a page, how doI go about doing it?.If you have started your template ..Everything in PHP is "mostly" between {{ .. }} {{if .. }} .. {{endif}} if you wanna output some variable .. then { .. } will do .. {$example} Very basic explanation ..Maybe you can add some more detail what you wanna do ? .
May 28, 20159 yr Author I am trying to get this code to evaluate and then display:function getLottery() { $lottery_machine = range(1, 49); $keys = array_rand($lottery_machine, 6); $say = "<center><h1>And the Virtual Vortex winning lottery numbers are: "; $count = 1; foreach ($keys as $key => $value) { if($count < 7 && $count != 6) { $say .= $lottery_machine[$value].', '; } else { $say .= $lottery_machine[$value].'. '; } unset($lottery_machine[$value]); $count++; } $bonus_key = array_rand($lottery_machine); $say .= "And the bonus number is: $lottery_machine[$bonus_key].</h1></center>"; return $say; } echo getLottery(); ?>
May 28, 20159 yr Author Ok, I created a custom block and got that code running. Do you htink I need to create a custom block for any html, or php I want to include in this page?
May 28, 20159 yr Ok, I created a custom block and got that code running. Do you htink I need to create a custom block for any html, or php I want to include in this page?.Custom blocks are easy to drag & drop & take away around all over your site ..If you feel like it needs a permanent place on a page you can use it in any template (not only blocks) .. .
May 28, 20159 yr Author Do you have any working code to read a text file via php off of the server that can be included in a block?
May 28, 20159 yr Author Trying to use this simple code in another block, all by itself and it is giving me an EX2 error:echo file_get_contents('/horoscopes/0');
May 28, 20159 yr Author Got it, I had to use a fully qualified server path to the file I wanted to read, instead of using the shortcut of "/file".
May 28, 20159 yr Author That was what I was working off of Jose, LOL!I was trying to use it with only a partial directory specified and it was crapping out. When I supplied the entire path, it magically worked. I am not complaining! LOL.
Archived
This topic is now archived and is closed to further replies.