Announcement

Collapse
No announcement yet.

Help! with if varible is not present

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help! with if varible is not present

    I am still new to PHP, and to tied me over until the Jelsoft CMS comes out, I want to implement a PHP Template to make publishing articles easier.

    I want to use the index.php of the folder for a article series to handle the index of articles if someone just calls that file or if they call it via /articleseries/?article=file-name then to display the article.

    I have a section of code which calls the article varible from the URL

    PHP Code:
    <?php Virtual("$article.txt"); ?>
    etc. But if someone just goes to the index page instad without entering an article ID.

    So what am I missing?

    PHP Code:
    <?php if (!article=); {
    and then after the article code

    PHP Code:
    <?php } else {
    which will display the index of articles instead.

    Also how do I do a loop, so it will get the $title varible from the included article to display in the title bar?

    Thanks.

  • #2
    I don't get it

    I just did

    PHP Code:
    <?php if ($article) { ?>
    and it worked. I thought I tried that

    but how do I do a loop, so that it will grab the $title varible from the include for the article?

    Comment


    • #3
      if (isset($article){
      include "$article.txt";}
      else{
      ...;}

      is that wot u mean?

      where is $title coming into it?

      Comment


      • #4
        try

        PHP Code:
        <?
        if(file_exists("./$article.txt")) {
          
        virtual("./$article.txt");
        }
        ?>
        Scott MacVicar

        My Blog | Twitter

        Comment


        • #5
          Be very carefull when you include files specified via GET or POST.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X