Jump to content

How do I include PHP in a pag page?s


wmarcy

Recommended Posts

Posted

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 ?

 

.

Posted

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();

?>

 

Posted

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?

Posted

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) ..

 

.

Posted

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');

 

Posted

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".

Posted

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...