article snippet rotation+php is it possible ?

Discussion in 'PHP' started by shadow213, Apr 22, 2006.

  1. #1
    i just saw this thing on a website..but later realised..tht if wud be a good addition to anyones site..

    what the script did was randomly take article snippets from your articles directory and show it on every page..on refreshing..new article snippets came up..i think it is good coz it will increase the internal linking of th pages and also provide new content as no 2 ppl will c the same thing and even the spiders to..tht is what i think..

    is it possible to get something like this done ?

    it somes up like this

    {link}where do u want to go today{link}
    blah blah.......
    agag
    agagg (link)click here to read the rest of the articles(/link)

    tht is a bad example but tht is what i cud come up wid .

    any input will be appriciated.
    thanks
     
    shadow213, Apr 22, 2006 IP
  2. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #2
    It is doable but what exactly do you need? The SQL query?
     
    Lordo, Apr 22, 2006 IP
  3. shadow213

    shadow213 Peon

    Messages:
    210
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey Lordo thanks for replying...
    Take a look at this page http://www.toonchooi.com/onlinebanking/
    at the botton there is this caption
    More Online Banking Tips

    When ever the page is refreshed 3 new set of articles are shown..with their links..i am intrested in something like this..but fetiching articles from a folder /articles/filename.htm

    can it b done..
    i tried to download the site and c what php include was being used as I have a site which does the same thing but I am unable to fig it out ..
    thanks
     
    shadow213, Apr 22, 2006 IP
  4. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #4
    You can not download a file to see the php code inside it. It is executed not printed.

    OK. There are many ways to do this. But are you good at PHP?
     
    Lordo, Apr 22, 2006 IP
  5. shadow213

    shadow213 Peon

    Messages:
    210
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    not much..i can handle most of wordpress...like basicediting and stuff....i found the sripts for rotation..but there are 4 of them and i don't know which one make tht feature work...at adsenseportas.com u get free niche site..and they have the article rotation in them..but i cud not judge the include taken..
     
    shadow213, Apr 23, 2006 IP
  6. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The SQL query you need is:
    SELECT * FROM articletable ORDER BY RAND() LIMIT 1
    Code (markup):
    Then echo the title of the article as a link to its url along with a snippet of the text.
     
    mad4, Apr 24, 2006 IP
  7. shadow213

    shadow213 Peon

    Messages:
    210
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I have no idea what u are saying :confused: ....i am not good at php..just know basics of it..like php used in wordpress..
     
    shadow213, Apr 24, 2006 IP
  8. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Where are your articles at the moment? Do you use a certain script for your website? Is it Wordpress?
     
    mad4, Apr 24, 2006 IP
  9. shadow213

    shadow213 Peon

    Messages:
    210
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I have a simple html site...not using any scripts..

    the articles are in the articles folder..so it will b mydomain.com/articles/article_no_1.htm

    Now how to proceed ? :confused:
     
    shadow213, Apr 24, 2006 IP
  10. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Unless your site uses a database then there is no way to automate this.

    You will need to learn php from scratch and then store all your articles in a database and pull them from the database to create your site.
     
    mad4, Apr 24, 2006 IP
  11. shadow213

    shadow213 Peon

    Messages:
    210
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #11
    thanks...
    will work..actually learning php was one of my this years target..:p
    so will work on it...anyway thanks for the idea...will find a workaround
    cheers !!
     
    shadow213, Apr 24, 2006 IP
  12. Deliwasista

    Deliwasista Member

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #12
    wow what a cool idea shadow.. id like to do that too.. ive found a site that offers a rotating tool - you just enter in your needs and it generates a script for you.. I havent tried it out myself waiting for kids to go to bed!! but might be of interest - also I havent looked at what sort of code they are using to make this work not sure if its php based yet but the link is -

    http://www.rotatecontent.com

    hope that helps!
    and thanks for the idea!
     
    Deliwasista, Apr 29, 2006 IP
  13. Deliwasista

    Deliwasista Member

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #13
    Oh goody goody found this

    "Script creation. After you have added content to your HTML table, you then upload the HTML file to the Tool, which converts the HTML information into a Javascript or PHP script, based on the information contained in the table."

    php is an option :)
     
    Deliwasista, Apr 29, 2006 IP
  14. Joobz

    Joobz Peon

    Messages:
    598
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #14
    why don't you get some sort of php banner rotator script from hotscripts and use that for your articles?
     
    Joobz, Apr 29, 2006 IP
  15. Deliwasista

    Deliwasista Member

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #15
    Happy to report the rotatecontent site was most helpful and in 5 mins I now have a page displaying 3 articles that randomly change with browser refresh. If you are not familiar with PHP the rotatecontent people give you nice clear instructions - note make sure your file extensions finish with a .php not a .html otherwise the php include script will not work. Eg the page that contains the php include script snippet and invariably will display your articles needs to be yourpage.php

    Also check most importantly check that your host will run php!!
    Please feel free to ask questions - I dont know much but am glad to help if I can :)
     
    Deliwasista, Apr 30, 2006 IP
  16. Ethiccash

    Ethiccash Peon

    Messages:
    150
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #16
    If your articles are in a given folder, you could try the following :
    - Write a little php script to extract a given /random number of lines in each article file : convert2snippet.php
    - Store all these snippets (choose a delimitor between them, #BREAK# for example in a new file : snippets.html)
    - Use a free ad / banner rotator to apply with your snippet.html

    This way you don't need database. Of course you need to manually run the convert2snippet.php or use cron, but it should be easy with the text manipulation features of php
     
    Ethiccash, May 6, 2006 IP