Jump to content

Adding pgp to a variable HELP


goocharlton

Recommended Posts

I am trying to use this code....

<?php
include("news_items.php"); 
			foreach ($news as $value) {
				echo "<p>";
				echo "<b>" .$value[date]. "</b><br>";
				echo $value[content];
				echo "<p>";
			}
?>

...inside a simple variable like so...

<?php
$variable = include("news_items.php"); 
			foreach ($news as $value) {
				echo "<p>";
				echo "<b>" .$value[date]. "</b><br>";
				echo $value[content];
				echo "<p>";
			}
?>

 

As you would already know this doesn't work. How do I achieve this?

Link to comment
https://forums.phpfreaks.com/topic/65584-adding-pgp-to-a-variable-help/
Share on other sites

news_items.php

funtion GetSomeData()
{
$tmp = "";
foreach ($news as $value) {
	$tmp .= "<p>";
	$tmp .= "<b>" .$value[date]. "</b><br>";
	$tmp .= $value[content];
	$tmp .= "<p>";
}
return $tmp
}

 

other php script

include("news_items.php"); 
$variable = GetSomeData();

 

 

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.