---
title: "Lagra fler funktioner i include?"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/15543-lagra-fler-funktioner-i-include"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Hallgren"
published: "2001-04-25T07:53:00.000Z"
updated: "2001-04-26T07:41:00.000Z"
replies: 2
views: 200
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/15543-lagra-fler-funktioner-i-include"
---

# Lagra fler funktioner i include?

## #1 — Hallgren, 2001-04-25T07:53Z

Yo!

Hur man jag lagra fler taggar i en include fil och sedan hämta dem?

Typ om jag vill kunna ändra bgcolor och vill ha alla alternativ i en include fil.

Permalänk: https://www.webforum.nu/p/15543

## #2 — SPiN, 2001-04-25T17:21Z

Typ:

```
:: includeFilen.php
----
<?php
define("BGCOLOR", "black");
define("TEXTCOLOR", "green");
?>
----
:: phpFilen.php
----
<?php
require "includeFilen.php";
php, php, php
?>
<html>
<body bgcolor="<?php BGCOLOR; ?>">
</body>
</html>
----
----
[red][b]Eller[/b][/red]:
----
:: includeFilen.php
----
<?php
bgcolor = "black";
textcolot = "green";
?>
----
:: phpFilen.php
----
<?php
require "includeFilen.php";
php, php, php
?>
<html>
<body bgcolor="<?php $bgcolor; ?>">
</body>
</html>
```

Om det var det du menade? :q :)

Permalänk: https://www.webforum.nu/p/318295

## #3 — niels, 2001-04-26T07:41Z

Jag har gjort ett template system för detta. 

Det består av en class som man initierar med en array med taggar som skall byta ut i en fil. 

Documentation:
Template class 

PHP Syntax:
$template = new Template('temp_name',
à array('PROP_NAME1'=\>'PROP_VAL1','ARG_PROP2'=\>'PROP_VAL2', ...)); 
$template-\>Top();
...
$template-\>Bottom();
\- Uses template files (\*.tpl). Searches in the ‘template_dir’ directory defined in prepend.php.

Template Syntax:
\<!-- top_start --\>, \<!-- top_end --\>, \<!-- bottom_start --\>, 
\<!-- bottom_end --\>
\- These labels divide the template into two parts, top and bottom. 

\[NAME:default value\]
\- Some of the values/properties can be set by adding a array with property values as seen above. The properties must be defined in the template. The default value is only used if the property isn’t defined in the array. 
\- Note that the \[\] – syntax can cause problems with js-code. 

Example:

my_layout.tpl:
\<!-- top_start --\>

\<html\>
\<head\>
\<title\>\[TITLE\]\</title\>
\<head\>	
\<body bgcolor=”\[BGCOLOR:#999999\]”\>

\<!-- top_end --\>

\<!-- bottom_start --\>
	
\</body\>
\</html\>

\<!-- bottom_end --\>

index.php:
require('prepend.php');
Import('Template');

$layout = new Template('my_layout',array('TITLE'=\>'Bosma 
à Development')); 

$layout-\>Top();

print('hello world');

$layout-\>Bottom();

Returns this to the user:
\<html\>
\<head\>
\<title\>Bosma Development\</title\>
\<head\>	
\<body bgcolor=”#999999”\>
Hello world.
\</body\>
\</html\>

Om du är intresserad kan jag skicka över: kontakta niels_bosma@hotmail.com

IDEE: Vore det inte bra om man kunde skicka upp filer tillsammans med sina forum postningar som man kan göra på <http://vb-world.net?>

Permalänk: https://www.webforum.nu/p/318296

---

Tråden på webben: https://www.webforum.nu/amne/php/15543-lagra-fler-funktioner-i-include
