Hi,
I'm trying to get my script to work. What I'm doing at the moment is I have a file (header.html):
and style.php:HTML Code:<html> <body> <title>%BOARD_NAME% • %PAGE_TITLE%</title> </head> <body> <table border="1px" width="100%"> <tr> <td> <h1>%BOARD_NAME%</h1> <p>%BOARD_DESC%</p> <p><a href="index.php">Index</a><br /><a href="viewf.php">View Forum</a><br /><a href="viewt.php">View Topic</a></p> </td> </tr> <tr> <td> <br />
Then when start_page() it called from another page it echos header.html, but with certain information changed.PHP Code:<?php
include("./config.php");
function start_page($title)
{
global $config, $func;
$header = $func->get_include_contents("./styles/" . $config['style'] . "/header.html");
$patterns = array('/%BOARD_NAME%/', '/%BOARD_DESC%/', '/%PAGE_TITLE%/');
$replace = array($config['board_name'], $config['board_desc'], $title);
echo preg_replace($patterns, $replace, $header);
}
?>
Currently I am having to type everything out manually - is there any way to get it to automatically do the arrays from what I've already got?
en.php
(these are not the full scripts, just enough to tell you what they do.)PHP Code:<?php
$lang = array(
// Common language
'LOGIN' => "Log In",
'REGISTER' => "Register",
'WELCOME_MESSAGE' => "Welcome to the boards, we hope you enjoy as much you do",
'COPYRIGHT' => "Copyright © BLAH 2012",
'FORUMS' => "Forums",
'TOPICS' => "Topics"
);
?>
Is there anyway way to change $lang to two arrays? Eg:
$lang = "LOGIN", "REGISTER" etc
$lang2 = "Log in", "Register" etc
I'm thinking a combination of print_f and preg_replace might do that.
If you can help then thanks :D
~Callum


LinkBack URL
About LinkBacks




Reply With Quote


