How can I ask my php include to search 2 folders for content?

Hi guys,
I'm using the below code to call content into my websites'
layout:
<?php @ require_once ("$pagename.php"); ?>
At the moment, I believe it will only search for files in the
same folder as my main template which is fine.
The thing is though, is that I want to put all the news files
in a folder called 'news'. Is there a way that this code can be
edited so it can not only search for and include files in the same
folder but also news/ ?
Thank you very much and I hope to hear from you.
All the best,
Mark

Spindrift wrote:
> Is there a way that this code can be edited so it can
not only
> search for and include files in the same folder but also
news/ ?
Use ini_set() to change the include_path configuration. The
actual code
you need to use depends on the operating system used by your
server,
plus the file hierarchy.
www.php.net/manual/en/function.ini-set.php
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/

Similar Messages

  • How can I get a PHP include to update automatically after a set date?

    Hi guys,
    I maintain a number of website for sports athletes and on their websites I have an include for their next event - just a small PHP file with when and where the next event is.
    After each event I have to manually update the include to the clients' next event which is a bit of a pain and quite time-consuming.
    Is there any way I can set up the include script to automatically update with a different file to include after a set date?
    Or, even better, can I set up the include itself to display the updated content after a specific date?
    This is what the include contains...
    <img class="event" src="/images/eventPicture.png" />
    <p class="nextEvent">Location<br />
    Series<br />
    1-3 January 2013</p>
    Thank you very much and I hope to hear from you!
    SM

    Its easier than setting up a database...I've been dabbling. You will still need to use server-side language like php.
    First establish the date by adding the get date function to the page:
    <?php
    $date = date('d-F-Y');
    ?>
    Then add the below bit of php in the position where you want the 'include' to appear. (so if on the 19th of April you want event_3.php to appear:
    <?php
    if ($date == "19-April-2013") { ?>
    <?php include ('event_3.php')?>
    <?php } ?>
    This isnt economical for many event dates but if you have a few it will do as a solution.
    It's not great because you would need to add as below, changing the include on the date you want it to show which will replace the previous event.
    <?php
    if ($date == "19-April-2013") { ?>
    <?php include ('event_3.php')?>
    <?php } ?>
    <?php
    if ($date == "30-May-2013") { ?>
    <?php include ('event_4.php')?>
    <?php } ?>
    <?php
    if ($date == "4-June-2013") { ?>
    <?php include ('event_5.php')?>
    <?php } ?>

  • How can I do a dynamic include of a page fragment?

    I have a technical support website with a lot of simple html pages. What I want to do is hyperlink from the index page to another page, which would display these html pages as a page fragment, dynamically based on a session bean set by the hyperlink.
    I basically want to do this, if it was possible:
    <jsp:directive.include file="#{SessionBean1.pageToDisplay}"/>
    Now the FAQ's has a topic "How can I do a dynamic include of a page fragment?", which would seem to answer my question.
    But this is all it says, and it makes no sense to me. Could someone please translate? :)
    "Using a page fragment file (but using instead of the usual Creator approach) will accomplish a dynamic include."

    Here is 1 solution:
    First add this to the jsp:root tag:
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    Then surround the page fragment directive with something like this:
                            <div style="position: absolute; left: 24px; top: 408px">
                                <c:if test="${SessionBean1.count > 0}">
                                    <jsp:directive.include file="testPF.jspf"/>
                                </c:if>
                            </div>

  • How can I ask MBP to use a specific router in my office?

    Here is the situation. My office is using lot of access point to create a wireless network environment. I think all of the wireless router is connected by cable to the main server in office. Most of them are G mode by one of it is N mode.
    I would like to connect with the specific N mode router, but as all of the router is using the same SSID and password, so how can I ask my MBP to connect with that specific N mode router??
    Thank you very much.

    Unless each access point were to advertise a different network name, so you could differentiate each, the Airport card will pick the one with the strongest signal, so the solution would be to sit right next to it. Sorry, but that's the way the cookie crumbles...

  • How can you take a video including music from IPhoto and put it onto a disk?

    How can you take a video including music from IPhoto and put it onto a disk?

    You need burn software which will author/encode the movie so it can be viewed using any DVD player - there is iDVD (still available as part of the retail 09 or 11 iLife disks at online resellers including ebay and Amazon) or Roxio Toast ($$) or Burn (free, but very basic).

  • Hi sir,Please how can i ask operation system for my MacBookPro 15 inch from Appel website ?

    Hi sir,Please how can i ask operation system for my MacBookPro 15 inch from Appel website ?

    Thank you for response , the question is : How can i download operation system from Apple website ?

  • HT201359 How can I ask for my money back

    How can I ask for my money back when an App. is advertised as free then totry and use they charged £2-50 then when you try to use it again they ask for £13-99 this is sale under false pretences, I paid the £2-50 thinking that was it but no they just keep saying they want more and more, so when you stop at £2-50 the App is totally unusable and I mean totally unusable you have lost £2-50

    The app developer is your contact.  No one here can help you.
    Barry

  • TS1424 my purchase was charged twice, how can i ask for a credit

    my app purchase was charged twice, how can i ask for a credit

    You can contact iTunes support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • How can I shut off all of the pop-up windows for all the Firefox updates?

    How can I shut off all of the pop-up windows for all the Firefox and Thunderbird updates?
    Apparently now Mozilla creates new versions of their browser and email apps every two weeks instead of just creating updates... I'm tired of all of the pop-up requests for these constant installation requests and all the problems that the new version installations create... I just want to use the software and be left alone.
    I can't find a way to make Firefox and Thunderbird stop with the pop-up requests for new installations... is there a way to do this or has Mozilla just got it rigged so one can't just use the software without re-installing a new version every two weeks and running in to new plugin issues and missing features every time?
    Help!
    Thanks,
    numetro

    Is it possible that her computer is infected with malware.
    Do a malware check with several malware scanning programs on the Windows computer.
    Please scan with all programs because each program detects different malware.
    All these programs have free versions.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *AdwCleaner:<br>http://www.bleepingcomputer.com/download/adwcleaner/<br>http://www.softpedia.com/get/Antivirus/Removal-Tools/AdwCleaner.shtml
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender:<br>http://windows.microsoft.com/en-us/windows/using-defender
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *Anti-rootkit utility TDSSKiller:<br>http://support.kaspersky.com/5350?el=88446
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • I have an iPhone 4S from China. How can I find out if it is unlocked, or unlockable, for service in the USA?

    I have an iPhone 4S from China. How can I find out if it is unlocked, or unlockable, for service in the USA?

    Contact the current carrier and ask.

  • How can i remove the bar (where i search for websites) when i full screen for my macbook pro

    how can i remove the bar (where i search for websites) when i full screen

    ohhh k i got it but thats not what i am looking for, so when i full screen i want it to be like fully full screen like when i watch a movie i want nothing but the movie on the screen and when i bring the mouse up then the tab shows again thats what exactly I'm asking about.

  • How can i cancel an at&t contract on iphone 5 for use in other country

    how can i cancel an at&t contract on iphone 5 for use in other country

    Contact AT&T and ask about paying the early termination fee.  You'll also need them to unlock it.
    In any case, you need to contact AT&T as they have the final say.

  • How can I get a new copy of the Voicemail app for my LG Spectrum?

    How can I get a new copy of the Voicemail app for my LG Spectrum?  It no longer works....the screen say Loading please wait....the
    !Visual Voice Mail - A Visual Voice Mail error has occurred.  Please try again. OK   I've tryed several times with the same message.  I've
    deleted the app from my screen and replaced it from the Apps Library....still the same message.
    I cannot find an answer on MyVerizon.  Any ideas?
    Thank you,
    Dee

    OK, at least 3 is working.
    I don't know how you have a Tape Recorder icon on your Home Screen. I cannot add one myself. But, I am running Holo Launcher in replacement of the default LG "Optimus" User Interface. It's much better in my opinion.
    Try long pressing the icon and select Edit and maybe you can change some attribute of the icon.
    Another thing you could do, is long-press an empty area of your desktop, to add an icon. Select Shortcut, then Select Contact, and scroll through your contact list and choose the contact that you added for *86.
    You realize if you have voice mail you haven't heard, there is a tape recorder icon in the notification bar, which you touch and pull down, then press it to dial voicemail.
    If that functionality doesn't work, you MIGHT want to consider doing a factory data reset on your device, but that is going to nuke all your personalizations and cause you work to set up again.

  • How can i use my smart TV as a second monitor for my Power mac (2010) via HDMI cable? i've made the connection but no options show in system prefs display.

    How can i use my smart TV as a second monitor for my Power mac (2010) via HDMI cable? i've made the connection but no options show in system prefs display.
    the computer:Mac Pro, Mac OS X (10.9.5), 2 x 2.66 Ghz 6-Core intel Xeon
    the TV: LG Smart tv

    The Mac uses a highly-parameterized universal Driver for every display. The parameters are set at certain times when a query is sent to your display. The display MUST answer with its name and capabilities, or the screen stays dark. A TV set that is off or "not paying attention" because it is set to a different port when the query occurs will rarely answer, and so will often remain dark.
    You can use tools in the System Report to see whether your display has been detected at all. If it has, the report will look something like this, but its name will appear:
    The times when the query is sent are:
    • at Startup
    • at wake from sleep
    • when the Mac-end of the cable is inserted
    • when using the Option ( Detect Displays ) button in displays preferences

  • How can I have another Itunes account on the same computer for my wife?

    How can I have another Itunes account on the same computer for my wife?

    In case you didn't fully understand what dallon meant, it means another user account on your computer. You set that up in Windows and then instal iTunes onto that account.
    That way, you each have your own desktop and your own itunes. You can link to the songs in the other person's library as well, but you cannot run both iTunes at the same time. (That simply means you need to close it on the first account before opening it on the second account.)

Maybe you are looking for