October 03, 2024, 02:15:36 AM

1,531,325 Posts in 46,731 Topics by 1,523 Members
› View the most recent posts on the forum.


for the 3 people who know php: help ;-;

Started by Daddy, December 05, 2008, 02:01:01 PM

previous topic - next topic

0 Members and 3 Guests are viewing this topic.

Go Down

Daddy

Say that I wanted to make a file that had stuff like
Code Select
<?php
$title 
"omg hi";
$content "PENIS";
echo 
"<title>$title</title></br> <table><tr><td>cool table</td></tr><tr><td>$content</td></tr></table>";
?>

I know that would make the title omg hi and show PENIS in the table.

but what if I were to

Code Select
<?php
echo "<title>$title</title></br> <table><tr><td>cool table</td></tr><tr><td>$content</td></tr></table>";
?>

Code Select
<?php
$title 
"omg hi";
$content "PENIS";
include(
"foobar.php");
?>

Would that work to load the file with the table, and replace the variables with the definition?

Daddy

Actually, I just tested it and it did work. ;0


Daddy

December 05, 2008, 02:21:17 PM #3 Last Edit: December 05, 2008, 02:24:40 PM by Angry Kewn Fruit
Quote from: russell on December 05, 2008, 02:09:46 PM
...yep
Yeah, I am getting tired of editing like 3043040 pages when I can just use 3 lines of code each.
Code Select
<?php
$title 
='';
$bodyContent ='';
require(
"template.php");
?>

and then be all template .php with
Code Select
<html>
<head>
<?php echo "<title>$title</title>"?>
<tag to load css shit>
</head>
<body>
<blah blah blah><?php include("navbar.php"); ?> </blah>
<blah blah blah next row> <?php include("$bodyContent"); ?></blah>
<rest of tags and shit>



So things like index.php would just have

Code Select
<?php
$title 
='INDEXTITLE LOL';
$bodyContent ='indexText.txt';
require(
"template.php");
?>
baddood;
It'd make changing the layout much easier since I'd only have to edit one file instead of each page.

Daddy

Something is wrong with the code in the last post. :(

Daddy

triple post.  baddood;


There was no problem with the code.
Aparently copypasting my own code from the forum into smultron copied the line numbers which I overlooked since they were line numbers.

russell

Quote from: Angry Kewn Fruit on December 05, 2008, 02:53:57 PM
triple post.  baddood;


There was no problem with the code.
Aparently copypasting my own code from the forum into smultron copied the line numbers which I overlooked since they were line numbers.


when I was your age we didn't even have line numbers

Daddy

Quote from: russell on December 05, 2008, 03:27:33 PM
when I was your age we didn't even have line numbers
They're taking away line numbers in the future?
FUCK

Go Up