Hi I'm a newbie

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ray
Forum Newbie
Posts: 1
Joined: Sat May 24, 2008 4:22 pm

Hi I'm a newbie

Post by Ray »

Hi, I'm a newbie, basically what I'm trying to do is load a template html.. can you see what's wrong with this code?

Code: Select all

function show_main_form()
{
    global $config;
    global $message;
    $tpl = implode("", file( "templates/admin/index.htm"));
    $page = str_replace( "{MESSAGE}", $message, $tpl);
    $page = str_replace( "<option value=\"".$config['language']."\">", "<option value=\"".$config['language']."\" selected>", $page );
    $page = str_replace( "{REDIRECT_URL}", $config['redirect_url'], $page );
    $page = str_replace( "{MAIN_KEYWORD}", $config['main_keyword'], $page );
    $page = str_replace( "{TITLE}", $config['title'], $page );
    $page = str_replace( "{DESCRIPTION}", $config['description'], $page );
    $page = str_replace( "{FTP_ACCOUNTS}", $config['ftp_accounts'], $page );
    $page = str_replace( "{INDEX_TEMPLATE}", $config['index_template'], $page );
    $page = str_replace( "{PAGE_TEMPLATE}", $config['page_template'], $page );
    $page = str_replace( "{CSS_TEMPLATE}", $config['css_template'], $page );
    $page = str_replace( "{XOAD_HEADER}", ( "include/xoad" ), $page );
    $page = str_replace( "{XOAD_OBJECT}", templateloader( new templateloader( ) ), $page );
    echo $page;
}
 
It gives me a blank page
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Hi I'm a newbie

Post by Ambush Commander »

Place var_dump($page); at various points to see where the contents of the variable are disappearing. From a quick glance nothing looks like it's going wrong; of course, I don't have the whole picture.
Post Reply