How can I write this short/simple bit of php so it will work?

Hello!
I have this code in template.php...
<?php @ require_once ("$pagename.php"); ?>
...to bring content into the template.
I've got a folder called 'news' for all the news articles so
how could I edit the code to say 'look for files in the news folder
as well as the current folder'?
I guess I would need something like:
<?php @ require_once ("$pagename.php" or
"news/$pagename.php"); ?>
...but that doesn't work. How would I change it to work?
Thank you very much and hope to hear from you.
Mark

You would need to use the "or" operator in PHP. I'm not too
sure if that
will work or not but you can give it a go - I'm currently at
work now, so I
can't really test anything at this moment in time.
This is the operator for "or" in PHP: ||
Shane H
[email protected]
http://www.avenuedesigners.com
===============================
Proud GAWDS Member
http://www.gawds.org
Delivering accessible websites to all...
===============================
"Spindrift" <[email protected]> wrote in
message
news:e5fhh5$sgv$[email protected]..
> Hello!
>
> I have this code in template.php...
>
> <?php @ require_once ("$pagename.php"); ?>
>
> ...to bring content into the template.
>
> I've got a folder called 'news' for all the news
articles so how could I
> edit
> the code to say 'look for files in the news folder as
well as the current
> folder'?
>
> I guess I would need something like:
>
> <?php @ require_once ("$pagename.php" or
"news/$pagename.php"); ?>
>
> ...but that doesn't work. How would I change it to work?
>
> Thank you very much and hope to hear from you.
>
> Mark
>

Similar Messages

  • List v = new Vector() how can i write this ?

    List v = new Vector() how can i write this ?
    vector does not 'extends' List rather it 'implements' only ......so how can write this way ? ( polymorphism applies only for 'extends' ).

    my question in a simple way is :
    List some_list extends Vector
    No, List is an interface; Vector is a concrete class. Read the javadocs.
    Vector implements List
    >
    AND
    List some_list implements Vector
    are these two same in behaviour
    our  apart from theoretical differences ?thanks
    Interfaces don't have any implementation; they're pure method signatures. When a concrete class implements an interface, it makes a promise that says "I will provide implementations for exactly these methods. Any client can call a method from the interface and I will do something 'sensible' if I'm written correctly."
    From the point of view of static and dynamic types, there's no difference between interfaces and classes.
    C++ has interfaces, too - they're classes with all pure virtual methods. If you understand how C++ works, the concept shouldn't be hard.
    ArrayList is preferred precisely because it isn't synchronized by default. (You can always make it so using java.util.Collections if you wish later on.) If you don't need synchronization, why pay the performance penalty?

  • How can i write this C-Code in G-Code

    hallo
    how can I write this C-Code in LabVIew ,
    for a=0; a=<10; a++
       for b=0; b=5 ; b+2
            X= 3+b;
      Y=1+a;
    please see the attachment and tell me where is the problem
    Attachments:
    Unbenannt 11.vi ‏43 KB

    Well, at least you tried and got some of it right.
    I think this should do what you want, but my C is rusty. Is the increment performed before or after the loop executes? If it's after, then I believe the loop should iterate 11 times, not 10.
    In any case, you should note that for a literal translation, you would need to add a sequence structure to guarantee that Y was written to only after the inner loop finished because of the way data-flow works.. Also, note that controls and indicators in LabVIEW are not equivalent to variables. They can be used as such, but they usually should not be.
    Another point about this is that you probably want to use the correct data type - the orange terminals are floating point indicators (of double precision, in this case) and you want integers.
    To learn more about LabVIEW, I suggest you try looking at some of these tutorials.
    Try to take over the world!
    Attachments:
    C.png ‏4 KB

  • How can I delete this today, please?? FYI: Skype continues to work just fine.

    since accepting the invitation to upgrade to Version 7, the following truly annoying popup box appears every time I open Firefox or one of my bookmarked sites: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [ISkypeFfExtension.Initialize]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://skype_ff_extension/content/browserOverlay.js :: <TOP_LEVEL> :: line 9" data: no]
    How can I delete this today, please?? FYI: Skype continues to work just fine.

    Thanks - but exactly how do I do that easily, please?

  • How can I write this string to a file as the ASCII representation in Hex format?

    I need to convert a number ( say 16000 ) to Hex string ( say 803E = 16,000) and send it using Visa Serial with the string control in Hex Mode. I have no problem with the conversion (see attached). My full command in the hex display must read AA00 2380 3E...
    I can easily get the string together when in Normal mode to read AA0023803E... but how can I get this to hex mode without converting? (i.e. 4141 3030 3233 3830 3345 3030 3030 3031 )
    Attachments:
    volt to HEX.vi ‏32 KB

    Sorry, The little endian option was probably introduced in 8.0 (?).
    In this special case it's simple, just reverse the string before concatenating with the rest.
    It should be in the string palette, probably under "additional string functions".
    (note that this only works in this special case flattening a single number as we do here. If the stat structure is more complex (array, cluster, etc.) you would need to do a bit more work.
    Actually, you might just use typecast as follows. Same difference.
    I only used the flatten operation because of the little endian option in my version.
    Message Edited by altenbach on 11-16-2007 11:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    littleendian71.png ‏4 KB
    littleEndiancast71.png ‏4 KB

  • How can I write this small function to create number of Array(s), please?

    Guys,
    How can I have a function create Array depending upon the passed argument. Am I doing this right?
    function createArray(n:int):Array
        for(var i:int=0; i<n; i++)
           var nArr = new Array();
           return nArr[i];
    Thanks a lot.

    var aArraySet:Array = createArraySets(5); //create 5 arrays
    // Array 1 -> aArraySet[0]
    // Array 2 -> aArraySet[1]
    // Array 3 -> aArraySet[2]
    // Array 4 -> aArraySet[3]
    // Array 5 -> aArraySet[4]
    function createArraySets(n:uint):Array
        var aArraySet:Array = new Array();
        for(var i:uint=0; i<n; i++)
           aArraySet.push(new Array());
        return aArraySet;

  • How can I write this SQL?

    the statement have the question:
         stxh-tdname  length 70
         itab-vbeln       length 10
    select tdobject into table it_stxh
        from stxh
        for all entries in  itab
        where ( tdid = 'Z006' and tdspras = 'E'      and tdname+0(10) = itab-vbeln and tdobject = 'VBBK' ).
    tdname+0(10) = itab-vbeln  ???

    When you define the first Internal Table ITAB, define vbeln as the same type of stxh-tdname.
    Eg.
      data: begin of itab occurs 0,
              vbeln like STXH-TDNAME,
              erdat like vbak-erdat,
              end of itab.
    START-OF-SELECTION.
    Select VBELN
              ERDAT
      from vbak
      into CORRSPONDING FIELDS of table itab.
    Then you can directly use  this ITAB in the next query
      select tdobject into table it_stxh
      from stxh
      for all entries in itab
      where ( tdid = 'Z006' and tdspras = 'E' and tdname = itab-vbeln
      and tdobject = 'VBBK' ).
    Pls reward it if it is useful.

  • I Phone 4S. I am unable to update the software. Evidently my I Mac ( 10.4) will not allow or support the sw update. How can I update  this device? The phone function is not currently working either. HELP ! at t

    I am unable to update my I Phone 4s through I-Tunes. I believe its due to my antiquated  10.4 operating system on my 2005 I Mac. How can I perform the software update. Currently even the phone function will not work . I'm a novice with this device.

    Whatever version of Leopard you purchase, I suggest updating it to 10.5.8 which should have everything you require. To update Leopard download and install Mac OS X 10.5.8 Combo Update. Alternatively, open Software Update and install all the recommended updates. That will include the above updater.
    To update your phone:
    Upgrading iOS
       1. How to update your iPhone, iPad, or iPod Touch
       2. iPhone Support
       3. iPod Touch Support
       4. iPad Support
         a. Updating Your iOS to Version 6.0.x from iOS 5
              Tap Settings > General > Software Update
         If an update is available there will be an active Update button. If you are current,
         then you will see a gray screen with a message saying your are up to date.
         b. If you are still using iOS 4 — Updating your device to iOS 5 or later.
         c. Resolving update problems
            1. iOS - Unable to update or restore
            2. iOS- Resolving update and restore alert messages

  • How can we write this in analytical function..

    select a.employee_id,a.last_name,b.count from employees a, (select manager_id, count(manager_id) as count from employees group by manager_id) b where a.employee_id=b.manager_id;
    As per my requirement I need each manager name and no of employees reporting to him... above query works.. Could anybody help to write the same using analytic function.... Hw this same can be written in effiect way??? (quick performance)
    Please also share the link to download some doc to have good understanding of analytical function..
    Thanks in advance....

    are you trying to do a hierarchical type of query?
    select ename, count(ename) -1 numr_of_emps_under_this_mgr  from  emp
    connect by  empno =prior mgr
    group by ename
    order by count(ename) desc ;
    ENAME     NUMR_OF_EMPS_UNDER_THIS_MGR
    KING     13
    BLAKE     5
    JONES     4
    CLARK     1
    FORD     1
    SCOTT     1
    ADAMS     0
    TURNER     0
    MARTIN     0
    JAMES     0
    SMITH     0
    MILLER     0
    ALLEN     0
    WARD     0Here is the table structure I used (I think you can download it from oracle somewhere)
    CREATE TABLE EMP
      EMPNO     NUMBER(4)                           NOT NULL,
      ENAME     VARCHAR2(10 BYTE),
      JOB       VARCHAR2(9 BYTE),
      MGR       NUMBER(4),
      HIREDATE  DATE,
      SAL       NUMBER(7,2),
      COMM      NUMBER(7,2),
      DEPTNO    NUMBER(2)
    SET DEFINE OFF;
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
    Values
       (7369, 'SMITH', 'CLERK', 7902, TO_DATE('12/17/1980 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        800, 20);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
    Values
       (7499, 'ALLEN', 'SALESMAN', 7698, TO_DATE('02/20/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        1600, 300, 30);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
    Values
       (7521, 'WARD', 'SALESMAN', 7698, TO_DATE('02/22/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        1250, 500, 30);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
    Values
       (7566, 'JONES', 'MANAGER', 7839, TO_DATE('04/02/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        2975, 20);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
    Values
       (7654, 'MARTIN', 'SALESMAN', 7698, TO_DATE('09/28/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        1250, 1400, 30);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
    Values
       (7698, 'BLAKE', 'MANAGER', 7839, TO_DATE('05/01/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        2850, 30);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
    Values
       (7782, 'CLARK', 'MANAGER', 7839, TO_DATE('06/09/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        2450, 10);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
    Values
       (7788, 'SCOTT', 'ANALYST', 7566, TO_DATE('12/09/1982 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        3000, 20);
    Insert into EMP
       (EMPNO, ENAME, JOB, HIREDATE, SAL, DEPTNO)
    Values
       (7839, 'KING', 'PRESIDENT', TO_DATE('11/17/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        5000, 10);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
    Values
       (7844, 'TURNER', 'SALESMAN', 7698, TO_DATE('09/08/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        1500, 0, 30);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
    Values
       (7876, 'ADAMS', 'CLERK', 7788, TO_DATE('01/12/1983 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        1100, 20);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
    Values
       (7900, 'JAMES', 'CLERK', 7698, TO_DATE('12/03/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        950, 30);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
    Values
       (7902, 'FORD', 'ANALYST', 7566, TO_DATE('12/03/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        3000, 20);
    Insert into EMP
       (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
    Values
       (7934, 'MILLER', 'CLERK', 7782, TO_DATE('01/23/1982 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
        1300, 10);
    COMMIT;

  • How can I write this query

    Customer Trans          Transaction     Invoice
    Code     Date Type      Amount
    A001     01-JAN-2004     invoice      1000
    A001     01-FEB-2004      Receipt      -1500
    A001     01-MAR-2004     invoice          2000
    A001     01-APR-2002     invoice          2500
    OUTPUT wanted to be...
    Customer Trans     Transaction     Invoice          
    Code     Date Type      Amount     Balance
    A001 01-JAN-2004 invoice 1000          1000
    A001     01-FEB-2004 receipt -1500          500     
    A001     01-MAR-2004 invoice     2000          2500
    A001     01-APR-2002 invoice     2500          5000
    Hi All,
    Please look into the above data, If analytic function LAG(),CASE expression are possible to locate the cursor position in the single query, then any one can help me out about it. I tried but could not.
    Regards,
    Neel.

    You can do this with the SUM analytic function. Taking the emp table, for example,
      1  select ename, sal, SUM(sal) OVER (order by empno)
      2    from emp
      3*  order by empno
    SQL> /
    ENAME                                 SAL SUM(SAL)OVER(ORDERBYEMPNO)
    SMITH                                 800                        800
    ALLEN                                1600                       2400
    WARD                                 1250                       3650
    JONES                                2975                       6625
    MARTIN                               1250                       7875
    BLAKE                                2850                      10725
    CLARK                                2450                      13175
    SCOTT                                3000                      16175
    KING                                 5000                      21175
    TURNER                               1500                      22675
    ADAMS                                1100                      23775
    JAMES                                 950                      24725
    FORD                                 3000                      27725
    MILLER                               1300                      29025
    14 rows selected.Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How can i write this syntax in script logic....

    hi all
    i need to write below syntax in bpc script logic..
    If Headcount = 0, then Salary = 0 Else:
    If Month <> March and Month <> September:
    Salary = Salaryprevious month1 + [(Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)]
    If Month = March:
    Salary = [Salaryprevious month1 + [(Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)]  ] * (100% + Band Annual Increase + Band Annual Increase Factor)
    in the above code headcount,salary,bandrate etc all got ids.
    thanks guys

    Hi,
    In your query, when you say that headcount = 0, do you mean the signed data? In this case, it will difficult to do. When you have a signed data as 0 in SQL, once you optimize the application or compress it, that particular record will go and your logic will not work.
    If I look at your logic,
    If Headcount = 0, then Salary = 0 Else:
    If Month March and Month September:
    Salary = Salaryprevious month1 + (Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)
    If Month = March:
    Salary = [Salaryprevious month1 + (Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)] * (100% + Band Annual Increase + Band Annual Increase Factor)
    If the application has been compressed or optimized, it will not get any record for that particular headcount and will directly go into the "else" loop. Though, its not correct.
    I hope you got my point.

  • How can I write this query In parameterize form so That I can prevent sql Injection

    String strQry = "INSERT INTO tblVoucherType (VhrTypeCode,moduleCode,transCCode,"
    + "voucherType,OrderNumber,active,AccountId) "
    + " values('" + txtVhrCode.Text + "','" + ddlModule.SelectedValue.ToString() + "',"
    + "'" + ddlTrans.SelectedValue.ToString() + "','" + txtVhrName.Text + "','" + btnRadio.SelectedValue + "'"
    + ", '" + status.Checked + "', '" + txtAccount.Text + "')";

    Basically it will look like:
    String strQry = "INSERT INTO tblVoucherType (VhrTypeCode,moduleCode,transCCode, ...)"
    + " values(@VhrCode, @moduleCode, @transCCode, ....)";
    sqlCommand.Parameters.AddWithValue("@VhrCode", txtVhrCode.Text );
    sqlCommand.Parameters.AddWithValue("@moduleCode", ddlModule.SelectedValue.ToString() );
    sqlCommand.Parameters.AddWithValue("@transCCode", ddlTrans.SelectedValue.ToString() );
    .. and so on
    sqlCommand.ExecuteNonQuery();
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How can i stop this type of pages in my system it will automatic open in web browser connected to net or not?

    content removed by moderator

    hello, if site open on their own you may have a malware issue:
    # [[Reset Firefox – easily fix most problems|reset firefox]] (this will keep your bookmarks and passwords)
    # afterwards go to the firefox menu ≡ > addons > extensions and in case there are still extensions listed there, disable them.
    # finally run a full scan of your system with different security tools like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes] and [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] to make sure that adware isn't present in other places of your system as well.
    [[Troubleshoot Firefox issues caused by malware]]

  • When i double click on Mac HD the view has changed and my user name is no longer listed on the left. How can I reset this

    When i double click on Mac HD the view has changed and my user name is no longer listed on the left. How can I reset this?

    Do a factory reset .. nothing will be deleted from your backups and you will be able to get access to them again.
    The Factory Reset Gen1-4.
    Unplug your TC. Hold in reset. and power the TC back on.. without releasing reset for about 10sec. When the status light flashes rapidly; release it.
    Be Gentle! Feel the switch click on. It has a positive feel..  add no more pressure after that.
    TC will reboot after a couple of minutes with default factory settings and will wipe out previous configurations.
    No files are deleted on the hard disk.. No reset of the TC deletes files.. to do that you use erase from the airport utility.

  • I need help!! My iPhone 4s lost contacts in messages after restore! How can I fix this?

    Earlier today I turned my phone off and back on...then I noticed that my contacts in my messages were not showing up, only the numbers. I tried to do a backup restore-- didn't work. I tried adding a +1 in front of all my contacts, that didn't work either. My contacts are still there, they are just not syncing with my messages. How can I fix this?

    izzystibbs wrote:
    my iphone ringer hasnt been working for a couple of days when i use the buttons to turn it up the volume bar isnt there? apple can u fix this now i have only had my iphone 4s for a month!!!!!!!!!!!!!!!!!!
    apple 

Maybe you are looking for

  • Podcasts and backing up

    when I set up my new iphone and signed in with my apple id, all of my downloaded podcasts (in the podcasts app) showed up withougt having to download them again. so I assume they were being backed up in a cloud -- but where? according to the apple we

  • Force reauthentication in a specific time - ISE 1.2

    Hi, is possible force wireless client reauthentication? For example: between 8am to 5pm all wireless clients use  authorization policy A and from 5:01 pm to 11:00 pm use authorization policy B automatically

  • Session variable reference in report title.

    Can someone suggest me a answer for my problem? I want to display the report title by with the logged in username. So, I've created a report and in the 'Edit View' of 'Title'view of that report, i just placed '@{NQ_SESSION.user}' in the Sub title sec

  • Redirect Users' Files Icon

    Hello, we are using folder redirection and all is working well - except the Users' Files icon on the desktop still points to a local location.  Where in Group Policy can I change this setting to their Home Drive on the server?  Thank you!

  • Why material ledger reversed?

    hi sap experts. in our compony, at the last of month when we run transaction ckmlcp and material ledger document create at the same time another document is created that have the same type of material ledger document , just reversed acounts , why thi