hi
how are you doin' ?

i'm writing a new PHP Script the display articles and stuff
i've displayed the latest article on the home page , in about 5 or 6 lines
but , the code i made will display the full article , and i want it to display 5 or 6 lines only , then a read more link , that will go to the full article page

and i don't know how to do that

you can browse the website @ http://test.techyew.com/dscms

and i will appreciate your help

thank you so much
Anmar Taweel

    You can use substr() to extract part of a string:

    <?php
       echo substr($article, 0, 500).'...';
    ?>
    <a href="link/to/article.php">Read more</a>

      thank you so much for your reply
      that was too useful , and it did the trick

      but , how will i send the article id to the article.php file that will view the article
      while article.php is just a template , and every article will be shown in it

      thank you so much againπŸ™‚

        hi
        everything have been solved for me
        except one last thing
        when trying to make an input : type="submit" , to submit the article id to the articles.php
        it's shown as a button

        is there anyway to make it look like a normal text with hyperlink ?

        like <a href="google.com">Google</a>

        thank you so much in advanced

          <a href="article.php?id=<?php echo $article_id; ?>">Article Name</a>

          Of course you'll need to put in your own variables to make this work. If you're still confused, show us the relevant code.

            thank you so much man
            i appreciate your help , and your codes are amazingly clear and working

            but still one last thing (my last question πŸ˜ƒ )

            hi
            everything have been solved for me
            except one last thing
            when trying to make an input : type="submit" , to submit the article id to the articles.php
            it's shown as a button

            is there anyway to make it look like a normal text with hyperlink ?

            like <a href="google.com">Google</a>

            thank you so much in advanced

              If you have to use a form, you would need to use CSS to style your submit input to look like a normal link. I would recommend using a button instead.

              button {
                 border:none;
                 background:none;
                 padding:none;
                 color:#000;
                 text-decoration:underline;
              }
              <form action="article.php" method="post">
                 <input type="hidden" name="article_id" id="article_id" value="<?php echo $article_id; ?>" />
                 <!-- other form inputs -->
                 <button type="submit">Submit</button>
              </form>

                wow , that's great
                but using <button> will normally submit the form like submit input do ??

                or should i specify parameters for <button> tag to make it submit the form ?

                thank you so much in advanced

                  button type="submit" will submit the form like input type="submit"

                    great , huff , that was a hard time

                    thank you so much dude
                    i really appreciate your help

                    and i will have the chance to give what i've taken

                    may god bless you πŸ™‚

                      Write a Reply...