Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 03:07:59 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Won't let me include php...  (Read 1175 times)
aimeeish

Offline Offline

Posts: 28


« on: April 30, 2008, 02:33:35 AM »

This is really frustrating. I have 3 external scripts that I need implemented into WB via the template. What I did is create a new a page under pages/ directory. Added the scripts through the pages/ directory as well. Then I implemented by creating a new page manually...this is what I did
Code:
<?php
require("../config.php");
require(
WB_PATH."/index.php");
?>


TEMPLATE CODE HERE (templates/mytemplate/index.php) full source code, no include

Then in the content, I'd add the code such as
Code:
<?php sfpg(); ?>

or

Code:
<?php

if ( !defined ('FNEWS_ROOT_PATH') )
{
    
define ('FNEWS_ROOT_PATH'str_replace ('\\''/'dirname (__FILE__)) . '/');
    include_once 
FNEWS_ROOT_PATH 'common.php';
}

$id = ( isset ($VARS['fn_id']) ) ? intval ($VARS['fn_id']) : 0;

if ( !
file_exists (FNEWS_ROOT_PATH 'news/news.' $id '.php') )
{
    echo 
$flns0;
}
else
{
    
$file fileFNEWS_ROOT_PATH.'news/news.'.$id.'.php' );
    
$news_info parse_news_to_view ($file[1]);

    
$temp_full get_template ('fullnews_temp.php'true);
    
$temp_full str_replace ('{post_id}'$news_info['post_id'], $temp_full);
    
$temp_full str_replace ('{subject}'$news_info['subject'], $temp_full);
    
$temp_full str_replace ('{description}'$news_info['description'], $temp_full);
    
$temp_full str_replace ('{user}'$news_info['writer'], $temp_full);
    
$temp_full str_replace ('{date}'$news_info['date'], $temp_full);
    
$temp_full str_replace ('{icon}'$news_info['icon'], $temp_full);
    
$temp_full str_replace ('{send}'$news_info['link_tell_friend'], $temp_full);
    
$temp_full str_replace ('{nrc}'$news_info['nrc'], $temp_full);
    
$temp_full str_replace ('{comments}'$news_info['link_comments'], $temp_full);
    
$temp_full str_replace ('{cat_icon}'$news_info['cat_icon'], $temp_full);
    
$temp_full str_replace ('{cat_id}'$news_info['cat_id'], $temp_full);
    
$temp_full str_replace ('{cat_name}'$news_info['cat_name'], $temp_full);
    
$temp_full str_replace ('{shortnews}'$news_info['news'], $temp_full);
    
$temp_full str_replace ('{fullnews}'$news_info['fullnews'], $temp_full);

    echo 
$temp_full;
}

?>


^^ That is the fusion news script to display full news.

When I open the pages, the template shows just the template and no PHP script...this is really frustrating. Also, the CODE Module is practically useless.
Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2298



WWW
« Reply #1 on: April 30, 2008, 04:07:10 PM »

If this is just for one (or a few pages), why don't you create a copy of your template (just change name and path in the info.php, zip and upload to WB), and install it as second template with your includes added to the index.php?

You can create a "normal" page, and select the "included" version of your template for that one.

Or am I misunderstanding the problem here?

Ruud
Logged

Professional WebsiteBaker Solutions
aimeeish

Offline Offline

Posts: 28


« Reply #2 on: April 30, 2008, 10:00:12 PM »

Rather inconvenient, but that would work. Why does this not allow php include unless if it's in the index.php file? This is ridiculous.
Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2298



WWW
« Reply #3 on: April 30, 2008, 10:44:06 PM »

WB is a CMS. This means a database is responsible for the content in the page.

If you look at the WB_PATH/index.php you will see a line:

Code:
$wb->page_select() or die();

This says: if you use this script, and the page is not served by the database: die()

It is not ridiculous, it is security, and just how a CMS works.

Ruud
Logged

Professional WebsiteBaker Solutions
aimeeish

Offline Offline

Posts: 28


« Reply #4 on: May 04, 2008, 02:34:28 AM »

Yeah, but the script I need included doesn't even use a mysql database.
Logged
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« Reply #5 on: May 04, 2008, 07:27:02 AM »

Hello,

please search the forum before asking a questions. Including external files/scripts is dicussed several times. Basically you should do the following.

As i understand you wanna include the script in the index.php of your template, so it could be seen on every page. So you have to options:

1.) Place the code directly in the index.php of your template.
2.) place the code in a file called sfpg.php (or whatever name you want) and store it with ftp in the /pages folder. Then call it in your template with
Code:
<?php include (WB_PATH."/pages/sfpg.php"); ?>
.

If you wanna have the code only on a specific pages then use option2 from above but do not place the code in the index.php of your template. Make a code section on the page where you need the code and add there
Code:
include (WB_PATH."/pages/sfpg.php");

Thats all

Matthias
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!