Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




From SSI Include To PHP3 Include


Im trying to convert my pages to php and have a problem, how do I change from SSI include (.shtml) to PHP include (.php3) so that I still can have the last line in my script,
(?start=11&end=15 after the .php3)

I have tried this: <?php include ("ssi-top10-15.shtml?start=11&end=15") ?>

and it didnt work, I used to have it like this:

<!--#include virtual="ssi-top15-25.shtml?start=16&end=30" -->

This works, but it leaves out the scipt part: <?php include ("ssi-top10-15.shtml") ?>




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Include Or Virtual Include: Neither Work For Subfolders
my includes files are all in my /ssi directory. I have many subfolders that call those includes files. Let's say I have a file like this:

/news/world/asia/thailand/index.php

In order to (relatively) call a file in the /ssi directory I have to use the following code:

<?php
include ("../../../../ssi/html-lang.htm");
?>

This is ridiculous. Everytime I make a new subfolder I don't want to have to add "../" to it. I heard about "virtual" includes but I'm not sure the syntax I'm using is correct (all I do is put 'virtual' after 'include'). Is there something I'm missing? Do I have to change the .htacess file? Help me please I'm going crazy. I don't want to resort to absolute referencing...

Error Says Can't See Include File, Yet Executes Some Code On Include File
I am using an include_once() command to include a file that sits a
level above the file view.php. when the code is run, I have an error
as follows:

Warning: include_once(../common.php) [function.include-once]: failed
to open stream: No such file or directory in C:Program Files..
view.php on line 2

Warning: include_once() [function.include]: Failed opening '../
common.php' for inclusion (include_path='.;C:Program Filesxamppphp
pear') in C:Program Files...view.php on line 2

The include command is simply: include_once(../common.php) - the '../'
before the 'common.php' to indicate a level above the current file
level. Is this right? I could not find a resource to confirm this.

The strange thing is that while the error seems to imply that the
calling file, view.php cannot 'see' the common.php file, other
functions called from the 'common.php' file executes correctly and on
the same calling file/page (view.php).

Appears to the a double take - quite confusing -

Can't Include 'http...foo.php', But Can Include 'http...foo.txt'
This seems weird, but when I use the following code,

include 'http://www.foo.com/includes.php'

includedfunction();

I am told that it is a call to an undefined function, but
'includedfunction' is on the server.

the following includes work fine, and the run the called function with
no trouble:

include 'http://www.foo.com/includes.phtml'
include 'http://www.foo.com/includes.txt'

all three include.php,.phtml & .txt are on the server and are exactly
identical. I am running php version 4.1.1.

Php Include
Hello, i am trying to use the php include command in source code to insert external page when a main page loads, but get the following errors.. can you help?

Php Include
I haven't really understood how to do what I want with PHP Includes. I have read the include section of the PHP manual but still don't understand. I've done one thing with PHP Includes but it's not what I want to do. It was just an example:

(HTML)
<html>
<body>
<form method=get action="condition.php">
What file do you wish to include?
<select name="Choice">
<option value="1">File One</option>
<option value="2">File Two</option>
</select>
<br>
<br>
<input type=Submit>
</form>
</body>
</html>

(PHP)
<html>
<body>
<?php
if ($_GET['Choice']<>"")
{
include ("file".$_GET['Choice'].".txt");
}
?>
<br>
Here is some text.
</body>
</html>

^ That's if you were curious in what example I did.

What I want to do is include the layout. The sidebar headers and contents, ect. It's basically like if I were to use an inline frame for a table. The content is on one page and I don't have to update everything. Every page would use the inline frame for the table so it's always up to date and everything. But that's not what I want. I don't really like inline frames and not all browsers support them. Your help will be greatly appreciated. Thanks for your time.

PHP Include()
I have two servers (say A and B) and I wish to include a PHP script on server A in a script on server B.

I have a test variable in a.php (on Server A) as ..

Php Include
how much serverstrain does php include take? does it take alot? if you have a lot of if else commands does that take the page longer to load? thanks alot.

Include();
I have searched the forum and could not find what I"m looking for. Okay, here is my situation:

I have a website which contains my layout as index.php. I want to seperate my content page into an include file, I can do that, just fine.

But, what I want to do, is have my hyperlinks INCLUDE the file when they click on it. For example

I have the links: Home - Contact - Resources - Services

By default, I have included the Home page

<?php include("date.php"); ?>

So it displays the content.

What I want to do is for my index.php include the other files whenever the user clicks on them.

So if they click on Resources, it will include("resources.php");

Include()
<?
if(!include ("http://forums.devshed.com/newthread.php?s=&action=newthread&forumid=5")){
echo "oops";
}
?>
why won't this work, I cant see the content of the page ....

I want to include a page on a different server and display contents.

Is It Possible To Have... <? Include ?> In <? Include ?>
Well, I'm setting up a script to make it suitable with my site. So, I'm wondering if I can use a sub <?include?> ?

Well, it's like

file1.php
<? include('file2.php') ?>

file2.php
<? include('file3.php') ?>
<? include('file4.php') ?>

Can I do this?

Help With Include Please
I have this code:

<?
required("style.php");
?>

and it wors fine, but when I click view source code in browser, the style properties are shown. Is there anyway to hide them.

Need Some Help In Include....
<?php include ("$id.htm");?>
i use this thing in my page to put other pages in it.. i want to make it like that if some one types a worng page $id he is moved to a 404 page.

Include And Log In
I have a question regarding include files. I'm currently wanting to secure
all of the pages within a directory by having a login script that queries a
MySQL DB, and writes a session variable confirming the user is successfully
logged in.

Now, I've done this many times before, however I'm getting kind of sick of
putting the include file to check the session variable on EVERY page within
a directory. This is especially irritating if I for whatever reason want to
unsecure a directory, or change the structure of the login system - it
forces me to go into each file of the admin area and remove the call to the
file.

My question is: Is there a way to have PHP force an include file per
directory instead of just file? Maybe have a global file inside the
directory that will cascade the include to every page below? Or am I simply
forced to manually include the file on each page?

Include
How can I include another php file into a php file. In HTML you use <?php
include test.php?>. But I want to include test.php somewhere in my php
script. How can I make that work?

Include()
I am running win2k, IIS 5, with php 4.2.2. When I use the php command include on a perl file all it does is out put its content instead of executing the file. Am I doing something wrong here?

URL Include !!!
I just started with php a few hours ago. I'm trying to include a file into the index page based on the url. It includes "home.php" into the content area of the page when http://mydomain.com/ is entered as it should.

However when I try to include another file with the name "test.php" via the url http://mydomain.com/index.php?page=test in includes "home.php" instead. I stole this script from a friends server where it worked fine. Is there something wrong with the script or do I need to change something in my server config?

I'm clueless as to what words to use when searching for a script of this fuction. Is there a resource where I can find something simular? PHP Code:

Include()
I'm forever having include() problems and am sure there is an easy way around this.
Say I have an include directory in the webroot /includes. And that one of the files in the includes directory includes another file in the same directory.

The page that then uses these files is then located from the webroot /level1/level2.
When the file in the includes directory tries to include the other one, it is looking in /level1/level2 and obviously can't find it.

Include
How can I include a file relative to the top level directory from any other
directory ?
I really hate to use absolut url or put all my files in one directory.

eg : include("<symbol for top>/somefile.php"); ?

Outside Include() Possible?
I know that its easy to include a file in a normal PHP file. PHP Code:

Include
I need a .txt file to become part of a php file. Not just as txt, but as php.

Include
I'm giving myself a headache trying to understand why some includes work and some don't. I'm a newbie at php so don't laugh too much if I'm being very dumb:

//1. This include works from a file in my root dir
include ("../hidden_folder/connect_to_a_mysql_db.php");
//indicating I can use relative file names

//2. But this include from a file in my root dir doesn't work
include ("/functions/format_some_text.php");
//indicating I can't use relative file names

//3. Whereas this works
include($_SERVER["DOCUMENT_ROOT"]."/functions/format_some_text.php");

Can anyone explain why 2. does not work?

Include()
I have a index.php page that has some text on it and I also have a edit_index page. From edit_index you can edit the text on the index page. But I don't want to store the information in a database or a text file but instead want to store the text in the index page.

Since the index page is PHP i made a variable at the top named $index_content and that holds the current text. What I want to have happen is for me to be able to, from edit_index, is edit the variable with the new text. So when I hit submit on edit_index I want it to call up index.php and redefine the $index_content variabled stored in the page. But i don't know how to write to a page like that when it's not apart of the script being executed.

I tried require(), but that didn't work, and I tried include() but that didn't work either. Is there some way to do this that i'm not aware of?

<<< And Include()
I am doing the method where you store all your html in a variable before echoing it to the screen. My web site is a combination of shtml and php files, and every file has several includes that define the page layout so I don't have to edit each file if I ever want to change the layout.

These included files are html files and I can't figure out a way to get the html in the included file into the html variable. Whenever I call the include, it prints it out to the screen right away. I have tried PHP Code:

Include Url?
why is it possible to include a url? what happens when a file is included. if it's parsed. are the variables still set? like if i have a file called. conf.php

which sets 2 variables
$username
$password

if i include conf.php from another server are those two going to be available in their script?

SSL & Include()?
Is it possible to include() a file hosted on a remote server via an ssl connection?
I've written a script that I'm using to send some information (for example, a username/password) to a script on a remote server (serverY) from a script on a local server (serverX), and does so via an include() command on serverX. Code:

Include() ?
if **include("file.inc")** is inside a function() or class->function(), will "file.inc" be parsed with the rest of the code in the very begining or only if function() was executed?

Include, But Other
What I want to do is:

execute script no.1 on server no.1 in this script i need to use some
function which will execute script no.2 on server no.2 and then return
variables created in this script.

why i need to do this?
both servers have MySQL servers which are set as localhost (both).
in script no.2 on server no.2 I want to execute query which take some data
and then I need to use that data in script no.1

Include Asp In Php
I'm writing a shoppingcart program in PHP. The website of our suplliers
webpage i written in ASP. He has very detailed info about his products, that
I want to include in my PHP page, I used include, require, readfile, even
something called Snoopy, but with everything that I try, I can't seem to get
the image inculed in the file. I just get the square with the cross in it,
like when you insert an image that doesn't exist.



Include Once
we have a project  that use a small include 'stuff.php'; The include statement is in many of there files in the project and  we get errors from function  definitions beoing duplicated. Is the include opnce the way around this, so if we put this in one script, other scripts that are transferred to will be able to use functons wiothout interference, and two-is there a php function that  we can tell if an include file is actuially included?

Include.. But It Doesn't!
this is my include file that i have uploaded on the server called
DB_1.php

<?php
function connect()
{
// SERVER connection
$con=mysql_connect('host', 'My_user_ID', 'My_Pwd');
// DB selection
$sql=mysql_select_db('Database_name');
}
?>

when i point my browser to www.yyyyyy.com/insert_form.html and i
submit the form, it recalls the follwing file:

<?php
include ("DB_1.php");
// connect();
$query_table="insert into table_name values('$_POST[nome]',
'$_POST[cognome]','$_POST[indirizzo]', '$_POST[telefono]',
'$_POST[cell]','$_POST[email]')";
$insert=mysql_query($query_table) or die(mysql_error());
if (mysql_query($query_table, $con))
{
header ("Location: http://www.yyyyyy.com/thanks.html");
exit;
}
else
{
echo '<br>something went wrong<br>'
}
?>



Include('') Tag
I have a question about the include('') tag; I want to include another document, say "page2.html" as part of my original page, "page1.php". Both documents have opening and closing "html" and "body" tags, so my question is could opening a second html and body tag inside of the first cause problems? page2.html has it's own <html> tag, so it would look something like. Code:

Php Include
With the standard php include command: <? include("filename.php") ?> do both the included file as well as the file that the included file goes on have to be php files?
If not, how could you do this using html files other than using frames?

About Include()
What is the most suitable condition to use include? I tried putting php codes in a txt file, and using the include function, the php codes in txt file actually function as php codes, not as normal texts... However, if you try to include php codes from a text file, wouldn't that be a bit risky? because if people enter php codes in there, it can gain a lot of access to information in the db.

PHP Include()
At work I mainly deal with Coldfusion, and just recently I started to work with PHP at home for my own projects.  When using the include() function is there a way to call in certain things (CSS) on those included pages just for layout viewing in Dreamweaver, but then when it gets uploaded, the server ignores it.

In coldfusion we have a <cfsilent>Link to CSS</cfsilent> tag so that we can see what we're doing exactly but then the server ignores it when it gets uploaded.

Include
I'm trying to use the include function for the first time, and I can't get it to work.  I'm sure it's something obvious, but could someone please tell me what's wrong?  I have two files:  test.php which calls cart_functions_test.php (both are in the same directory). Code:

What To Use Instead Of Include?
I was wondering is there any other way to have the same function as include?
My server recently disabled include so I can't use that anymore and they told me I can use fopen. I searched on the net but I don't seems to be able to make it work!!! What I want to do is SO SIMPLE. I just want to render a header inside the main php page. What I had before was (to load a menu):

<?php include("http://xxx.net/static/topmenu.html"); ?>

Include()
I have a script to backup a particular database. If I create another instance of this script I can backup a different database, and so on. If I have (say) 10 databases to backup, I would have to create 10 instances of this script. That's not the problem.

The problem is that rather than create 10 cron jobs, I would like to have one file call the 10 scripts, with a 30 second interval between them. Then I would only need one cron job. Is there a way to have one script call other scripts? I have tried variations on the code below, but only the first script gets called. Code:

Include And Get
I am looking to do something like:

include('file.php?id=1');

This doesnt work, is there a way to do something like this?

PHP Include
This is an include code a friend wrote for me for my website:

?php
$id = $_GET['id']; // Page requested
if(strstr($id,"..") != FALSE) {
include("blocked.html"); // Give them an error message
} else {
include($id);
}
?>

This code does not seem to be very secure as people can easily run remote websites and scripts through my site (ie by typing ...php?id=http://website.com ).  I was wondering if maybe someone could show me a more secure include since I am having trouble finding one that works.  Also, if there are better methods of similiar functions as this code.

Php Include
Is it okay to use php include between the head tags of the html? Will it create any problems?

Include
I am including a php file into a webpage, but the problem i am having is i want to put a limit to the number of characters before it says 'read more'

Its an article for my site, and it'll be on my homepage so i want it to be a certain length only before it gives the 'read more' link to the full articles

Does anyone know how i can set a limit to the length of the articles before it gives the read more link.

Include In A Function
if i use include() inside a function will the page included right away or only when the function executes?

Include Paradox
I know this topic has been covered before, but i've run into a peculairity of php.

on my site, i have a master index.php. based on query string variables, index decides which pages to include, e.g., main_body, right_nav, etc.

check out URL to get a look at my site. i am re-coding it to use sessions, and to clean up my code.

i have a set of session manipulation functions, which i include in my right nav bar to display a "mini-cart" view of the user's shopping cart. when i am displaying products, i need these functions to determine if a product is in the user's cart already.

in theory, i ought to be able to do this:

session.inc:
function is_in_cart($stock_number) {
if($_SESSION["cart"]["$stock_number"] > 0) {
return true;
} else {
return false;
}
}

index.php:
include_once("session.inc");

include("rightnav.php");
include("product_display.php");

here's what's interesting.

in rightnav.php:

if i DON'T include session.inc, when i call is_in_cart, php blows an error "call to undefined function" -- despite the fact that it has been included in index already. if i DO include session.inc in rightnav, it says "cannot redeclare function". this seems retarded to say the least.

it's a moot point as to whether this strategy of using variable includes is a good idea or not, as i'm already too far down that road. however, i could implement my session logic as an object if that is a work-around to php's seeming inability to cope with what i am trying to do. has anyone seen this before? is there a hack?

What Is Wrong With My Include()?
Can someone tell me why this works:

Include Along With Forms
I have a problem using a form in a page that uses includes. All alone the form works great. When placed in an include file or in another page that has other includes in it things go to the dogs.

It will show itself on the page ok but will not save to the table. Also what is strange is I can enter data in the fields only by starting at the top field and using the tab key. It will not jump to a field with a mouse click.

Am I breaking some rule or is in my code somewhere?

How Do You Incorporate A SSI Include Into PHP?
Here's my question: i have recently upgraded my html site to PostNuke.......which uses templates and modules. My current web stats is tracked by WebTrends..........I've been trying to figure out how to incorporate their advice, in implenting their trakcing code into my new Nuke site.

they suggest creating a separate file and placing a SSI include to that file in the footer of the template that drives all pages.

Here's the deal, i'm a PHP newbie but I do know that a SSI include requires .shtml extensions.

How can I go about using the PHP include tag of <? include /?> to call to this file?

please be specific with this newbie

for instance, with html i would tag it as
<!--include virtual="myfile.inc"-->

Full URL Include Using PHP
I am trying to insert a full URL include using PHP.

The problem is the link within the PHP is using my domain name instead of it's own.

Example:
URL

When it should be:
URL

Any clue as of why?

Here is the include code that I used:

Include() And Require()
In all of my pages i use the require() tag and it includes a file called global.php.

but when i have a file such as articles.php in a directory called articles it wont include it, i has an error, so how can you include it when it is in any directory?

Include JS Script
How can I include a javascript and have it executed in my pages.

If I use the include file, I can get text to display, but I need a javascript to display a column of rollover buttons.

Reason being that my site was 100mg, and then I added to JS script and my site is now 900 mgs. Yikes.

Can I inlcude the JS using PHP? So that the script is on my site just once.


Copyright © 2005-08 www.BigResource.com, All rights reserved