Jump to content

How do I include PHP in a pag page?s


wmarcy

Recommended Posts

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 ?

 

.

Link to comment
Share on other sites

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

?>

 

Link to comment
Share on other sites

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

 

.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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