GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   php help, real easy, for free porn! :D lol (https://gfy.com/showthread.php?t=701460)

amateurcanada 01-31-2007 11:46 AM

php help, real easy, for free porn! :D lol
 
Help me and i'll toss ya a membership haha ;)


I am trying to setup a table where i have it as a template and one with all my data. id like to load some fields from table one, and have them displayed from templates made in table 2. below is an example, however it doesnt seem to parse the variables pulled from the database when its encoded into another template.. below is my example - the field is set to text, also tried longtext






$DBLINK = mysql_connect($DBHOST, $DBLOGIN, $DBPASSWORD);
mysql_select_db($DBNAME, $DBLINK);

$result = mysql_query("SELECT * FROM galleries WHERE ID = $gid",$DBLINK);

if ($myrow = mysql_fetch_array($result)) {

do {



$result2 = mysql_query("SELECT * FROM templates WHERE ID = 1",$DBLINK);

if ($mytemplate = mysql_fetch_array($result2)) {
do {
echo $myrow["modelname"], $myrow["modeldir"], $mytemplate["format"];
} while ($mytemplate = mysql_fetch_array($result2));
} else {
echo "Sorry, no templates were found!";
}

} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
?>

amateurcanada 01-31-2007 11:17 PM

"tear" no help

bonkerz2007 02-01-2007 01:13 AM

so you have a table full of templates and you want to load a template that will pull data from another template? If that's what you're trying to do I think you're going about it wrong. If that's not what you're trying to do then please explain again.

amateurcanada 02-01-2007 11:21 AM

Yes, the page i showed you is a sample of what i want displayed. so it will load sql values from the request ID (e.g. a model set) and then bring up a template from sql (ill have multiple templates)

so the template loads, with variables i bring up from the sql above, which doenst work. in the text field it parses the text but not the php or varialbles <? echo $blah; ?>

Bro Media - BANNED FOR LIFE 02-01-2007 11:40 AM

would be better to pull templates from flat file, as your way adds an unneeded query that could cripple your server under high loads

example:

create a file say post.html and put it in templates folder

then put variables such as ##header## in that file then create a php page with this code

$SQL = mysql_query("SELECT * FROM Table WHERE ID = '1'");
$Data = mysql_fetch_ojbect($SQL);
$Template = file_get_contents("templates/post.html");
$Output = str_replace("##header##", $Data->Title, $Template);
echo $Output;

chonis 02-01-2007 11:42 AM

Try this:

$DBLINK = mysql_connect($DBHOST, $DBLOGIN, $DBPASSWORD);
mysql_select_db($DBNAME, $DBLINK);

$result = mysql_query("SELECT * FROM galleries WHERE ID = $gid",$DBLINK);

if ($myrow = mysql_fetch_array($result)) {

do {



$result2 = mysql_query("SELECT * FROM templates WHERE ID = 1",$DBLINK);

if ($mytemplate = mysql_fetch_array($result2)) {
do {
extract($myrow);
echo $modelname, $modeldir, $format;
} while ($mytemplate = mysql_fetch_array($result2));
} else {
echo "Sorry, no templates were found!";
}

} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
?>

amateurcanada 02-02-2007 02:42 PM

I guess its most efficient to do a template html file or to setup individual php pages per template and go from there.. thanks guys...


All times are GMT -7. The time now is 05:46 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123