Question by ElQuestionaire: How to include elements from different webpages using PHP or JavaScript to my home page?
I have a homepage (MyHome.php). On the homepage, I'd like to display the latest 3 posts from another page (Post.php). For example. I want to include the first 3

tags from Post.php into a
tag on MyHome.php. Is it possible to do this?


Best answer:

Answer by George H
It really depends on how you are accessing your database....doesn't matter if it is SQL or flat files, but why not send a url variable to your post.php file like:

include ('post.php?amount=3'); That way when you hit your post.php script you can check if there is an amount variable via the GET method and just do a quick for loop to display that many posts. Hope this helps.



Give your answer to this question below!
Related sites: Link , Link , Link , Link , Link
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 twkaho 的頭像
    twkaho

    KahoILoveMarket

    twkaho 發表在 痞客邦 留言(2) 人氣()