TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,234
  • Total Topics: 21,353
  • Online today: 739
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 540
  • Total: 540

include not working in my blocks :(

Started by BlueSteel, March 31, 2006, 04:52:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Blue Steel

I can't get include to work in php blocks..

eg:

Include("../path/filename.php");


how do i get this to work.. are there any server settings i need to adjust etc...

I've even tried someothers blocks that use include and all i get is an empty block

I've also tried it in a php article with the same results

MetalHellsangel

all includes should be relevent to your smf root directory, and make sure not to use <? ?> php tags in the blocks/articles

ie..  if this is your layout


smf_folder
my_file_to_include.php

you would right

include (../my_file_to_include.php)

Blue Steel

ok.. i've tried everything i can thinkof to try to display a sample block that contains include('../ssi_examples.php');
include(../ssi_examples.php)
include("../ssi_examples.php");
all with no success

and yes ssi_examples.php is in the main TP install dir
and no i don't have any <?php  ?> tags in the block

as a say no matter what i try all i get is a blank / empty block

MetalHellsangel

You need to think of the SMF root directory when your doing this (where your index.php file is. everything in your smf forum is relative to that, so if you had some thing like this

SMF_INDEX.PHP
A_FOLDER/MY_FILE.php

and you wanted to include MY_FILE.php you would write

include('A_FOLDER/MY_FILE.php');

but sense you want to include SSI examples.php

you would write

include('ssi_examples.php');

sense it existes in the same folder as smf's index.php. See what I mean

gerrymo

It should just be include('ssi_examples.php'); No path needed.

MetalHellsangel

yes that's exactly what I was trying to explain thanks gerry :D

Blue Steel

great thanks... i have it working now.. I thought that to make suire that one was reading it from the base dir that you needed the ../ to go back a dir .. and that is what was making things fall over..
but now lets say that i want to include in a php file a file that is in a different dir..

eg:
starting script is in home/blocks
files referenced in that file are trying to include files from in the home dir
which in turn are trying to get files in home/Sources
which are there again getting files from in home/cpg144

I'd want them all to be able to include files from any stated sub dirs with out having to go in and edit all their files

Is there a way to write like an include path for use on the site in a general file where i could just list all the subdirs i'd possably be including files from

what i'm eventually trying to do is like set up an article that will contain several iframes

one containing a forum catagory relating to topic of article
one containing a download catagory relating to topic of article
one containing gallery catagory relating to to topic of the article
one containing weblinks catagory relating to to topic of the article
and other articles on that subject matter

Is this possible... (well i know it is.. but how hard is it to do)
any tips etc

this is why i need to be able to call includes from all over the place on the site in blocks and articles



This website is proudly hosted on Crocweb Cloud Website Hosting.