You are here: Re: Change included code « PHP Programming Language « IT news, forums, messages
Re: Change included code

Posted by Jerry Stuckle on 04/19/07 05:44

Jon Slaughter wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:MumdnVsZlqGEe7vbnZ2dnUVZ_uLinZ2d@comcast.com...
>> Jon Slaughter wrote:
>>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>> news:D5-dnQ6alNLrQrvbnZ2dnUVZ_jednZ2d@comcast.com...
>>>> Jon Slaughter wrote:
>>>>> Can I modify code that I have included using
>>>>>
>>>>> <?php
>>>>> include("../Index.php");
>>>>> ?>
>>>>>
>>>>> The Index.php file contains links that need to be modified to work.
>>>>> Index.php is basically an html file uses a linked css file and when its
>>>>> included in the new file its referencing a css file in the wrong spot.
>>>>> I need to add "../" to the css file reference in Index.php to make it
>>>>> work.
>>>>>
>>>>> Thanks,
>>>>> Jon
>>>> Ensure your link is an absolute path relative to your website root. Then
>>>> where you include index.php doesn't matter.
>>>>
>>> It would actually be a bit more trouble since any time I want to upload
>>> to the server to test I will have to change the link. Would be easier
>>> just to have php just add "../" to one spot instead manually doing it
>>> every time I upload to the server.
>> And why is that? I never have to change links when I upload to my
>> servers.
>>
>
>
> Um, because the directory structure differs on my server than my computer?
> My server uses public_html to hold html files while my computer doesn't. I
> suppose I could go mess with the apache config file and change it though but
> it still doesn't solve my problem complete. I still need to inject html
> files into containers in the html/php code.
>

So? Mine differs also - my test system is Windows and most of my hosts
are Unix. And my directory here is much different than the one on the
server. I just set up Apache to handle it. Much easier than trying to
screw around with files like you are.

> e.g. when I do
>
> <?php include ('SomeFile.php') ?>
>

<?php include ($_SERVER['DOCUMENT_ROOT'] . '/SomeFile.php'); ?>

Use the features of the language.

> I need to also do something like
>
> <?php include ('File2.php') INTO This.DOM.MainDiv ?>
>

> (just psuedocode)
>
> That is, SomeFile contains a html container that I'd like to fill with
> another file(Which needs to be arbitrary).
>

Same thing.


> Maybe I'm going about it wrong but I'm simply trying to make a template that
> exists on pages of my web site. Because of the design of the template I
> cannotjust do something like
>
> <?php include ('SomeFile.php') ?>
>
> dflasdjflalsdflkaslkdjf
>
>
> and have that texted show up in the right place. I could split the file
> into something like
>
> <?php include ('SomeFile1.php') ?>
> dflasdjflalsdflkaslkdjf
> <?php include ('SomeFile2.php') ?>
>
> and then it would work but just doesn't seem elegant.
> (basically SomeFile1.php ends like
>
> <div class="Container">
>
>
> and Somefile2.php has the final code
>
> </div>
> </body>
> </html>
>
>
> I might end up using that though as it seems pretty simple
>
> Thanks,
> Jon
>

Whatever. I just include files where they are needed. Sometimes
they're at the top of the file, sometimes the bottom, and sometimes in
between.

What's more important - something you think looks "elegant", or
something which works and is easy to maintain?




--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация