SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there...my company is in the midst of a proposal. One of the things that the client is interested in is the idea of sharing content with various partners of theirs . My client will be creating stories, articles and other fresh content daily and would like to sell the use of this content to their partners.

    My question is how would I do that? They are basically wanting to be able to put a few lines of code onto the partner page and have it pull from our (my clients) database.

    Is that possible? How would it be implemented in PHP/mySQL? I have seen it done before on sites like SlashDOT, Yahoo and the like and I thnk it is accomplised with XML, but how?

    Any tutorials, suggestions, full code implementation or snide comments are welcome.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  2. #2
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SlashDot uses what they call Slash. They also have a page here which has links to scripts that grab their headlines, so that should give you a starting point... Good luck..

  3. #3
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Has anyone seen anything similar to that script setup done in PHP?
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  4. #4
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can believe it is possible.

    I am not clear on the frequency of the update to B (below).

    The first thing you want to do is provide B with a user id and password. They may want to be billed for item by item dled and even if they do not the customer will want to be able to justify fees with some actual count of article multiples delivered. This will allow them to identify who they are and you can check to make sure they are authorized to get the data (account current etc). Now the provide A, writes two content items for each article, a brief 3 line teaser and then the article. The teasers may be organized by A or B. But it is downloaded at predefined times daily. Here someone else could give an idea on how B may take the teasers and order them in a format on A prior to downloading. Now that the organized items are in place on B they may be readily accessed by C. An article click area for the the complete item will bring it to the designated location on the page.

    Three elements A - Provider, B - Provider Client, and C - User. Provider updates files.

    There are many details but I think it could be done. Part of the key is the agreement between A and B. for example, one com may want Sports, another homemaking, state government, etc.

  5. #5
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At a very simple level, you can just do this:

    Have site A (which contains all the content) generate a nice easy to parse text file dynamically somewhere on the site. For example if you were transferring news stories the text file couldbe formatted like this:
    Code:
    97887777||The Aliens have invaded!||Skunk||It was a terrible night last night as it was confirmed that aliens really have invaded earth...
    97887777||Bill Gates buys Manhattan||creole||Microsoft last night announced that their headline deal to buy Manhattan from the US government had been given the go ahead by spineless congressmen...
    Here's the file format:

    TimeStamp||Headline||Author||News Story

    Put a single news story on each line of the file in the above format. You'll have to make sure there are no line breaks anywhere in the story itself, but that can be easily achieved by replacing them all with <br> tags.

    Now.... site B (the client server) has a CRON job which automattically retrieves the above text file via wget every 5 / 10 / 15 minutes (or however often you want it to) and saves it as a local copy on the server's file system. Site B can then run a simple PERL or PHP script on the file (which can also be sheduled by CRON) which breaks up the news stories and sticks them in a database. They can then be accessed by site B's content display system.

    This is a very basic way of achieving what you want, but it should work just fine. If you want to get a bit more complicated you should look into generating an XML file on site A's server which Site B can then read and parse - this is a bit trickier but a lot more flexible in the long run.

    Finally there's always Netscape's RDF format - I don't know anything about it but it's supposed to be pretty much the standard way of transferring news headlines between sites (slashdot.org uses it a lot for their custom news headline boxes down the right hand side).

    Hope this helps,

    Skunk

  6. #6
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    As they (whoever "they" are) say, "The devil is in the details".

    Back to one of the items I mentioned. Each of the partners could be provided a partner number and that number be used in the same manner as the category in Kevin's tutorial. This would allow them to specify say Sports and Stocks, which would have their own id,s and the pull could be very easily customized. While it is coming out you could order (arrange) it in any fashion desired.

    This really sounds like a neat project.

    Oh and the Sports could be a seperate table, and one for each major header, Soccer, badmitton, horseshoes on a differnt level. Fast as all get-out.

    Not to just plan for the initial but also for the growth.

    peace

  7. #7
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the whole thing would be easier than all of you are thinking.

    a) MY company is going to be the only ones adding content. We will have some stuff to do every day, but some will be able to be scheduled (in advance entries you know).

    All i want to do is to have the server run a CRON (or something similar) once a day. That CRON will access the database and write an .xml file (or something similar) containing all news stories for that day to the server. Then I write code for the affiliates to put on their site. They determine the format, we provide the content.

    Does that make more sense?

    I found several scripts on www.hotscripts.com that would probably do what I need. I will just have to learn how to implement them.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  8. #8
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wouldn't it just be easier to write a small script that could be passed info through the querystring, then just have them include that on their homepage? The script would simply go to the database, log in with a querystring specced username and password, and get querystring specced information. Then you could have a bunch of templates or something, and depending on the username and password it would use a certain template and print the output. It would also log the access into a file. You could then charge whoever is using this by the number of hits per day on the certain script, to make sure that you didn't get swamped by bandwith charges.

    This way, there is very little programming involved, and you client only needs one line of code which you can send them. The only thing they need to give you is the template.

    ... what's the world coming to?

  9. #9
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See, though, we want to provide this "code" to the affiliate so that they can implement it without any hassle on their part. I don't want a template for each affiliate, I just want them to get the news in their normal page.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  10. #10
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In that case, perhaps, you could just have it spit out text, that they could put where they want. Even give them a list of querystring commands they could use to customize content. Or, you could just run a CRON job

    ... what's the world coming to?

  11. #11
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think printing out a file file once a day would be the best way to do it. That way the server would only have to work just that once (for the content).

    Now I just need a way to get the server to spit out the content I need and then the code to put on the affiliate page. I would like to work with XML so that I can get some experience with it.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  12. #12
    SitePoint Addict ibeblunt's Avatar
    Join Date
    Jan 2001
    Location
    Jersey City, NJ
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Someone wanted to use my headlines on thier site. I wrote a PHP script to put my headlines in an external javascript file and all the person had to do was insert one line of code:

    <script language="JavaScript" src="http://www.sohh.com/templates/thewire/dailynews_style_5.js"></script>
    <///////~

    www.sohh.com

  13. #13
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did the same thing, only for a different reason. I had forums run by CGI and I needed to have dynamic content which was updated by other sites to show their newest articles. I just wrote a PHP script to allow the different users to login, then each wrote to a different *.txt file.

    I then exploded out different info and made a PHP script which got the data from different files depending upon what control I gave it. Worked like a charm. I could then include the new articles from other sites anywhere in my website, PHP or non .

    Here is what I would do. If you are using a database, which I imagine you are, and I pray that the webmaster's you are dealing with are capable of manipulating data, then follow my madness, for there is method in't.

    Say you have a table called stories, with the following columns:
    Code:
    id
    author
    date
    title
    content
    Then use refferer to allow access to the following file:

    PHP Code:
    // URL looks like this:
    // [url]http://www.yourdomain.com/articles.php?old_date=5[/url]

    $sql "SELECT * FROM stories WHERE date + 0 > CURDATE() + 0";
    $result mysql_query($sql);
    $i 0;
    $e mysql_num_rows($result);
    while(
    $row mysql_fetch_array($result)){
        
    extract($row);
        
    $content ereg_replace("|""[line]"$content);
        if(
    $i $e){
            echo(
    "$id|$date|$author|$title|$content[new_data]");
        } else {
            echo(
    "$id|$date|$author|$title|$content");
        }

    See how that would work?
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services

  14. #14
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is exactly what XML has been designed to achieve! - the transfer of data accross hetrogenous and distributed networks and platforms. That's the point for XML, you publish your data definition file and then anyone will be able to parse your XML into their web page, or whatever. I wish I had more experience and knowedge of XML. I really must learn it!

    How you serve the data could be to cache it as a static file that gets updated periodically by running a crontab that generates the updated data. Or by calling a script that creates the data on demand.

  15. #15
    SitePoint Zealot New Oddity's Avatar
    Join Date
    Jun 2001
    Location
    Georgia
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you set it up so that your server has a "allow 'domain'" entry in your access.conf file so that only the domains you specify can pull off a certain part of your site...
    --Odd
    "We all live in a yellow subroutine."
    "Some call it insanity; I call it inspiration!"

  16. #16
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep, this is exactly what XML was designed for. You create a DTD and then output the XML file, then the clients parse out whichever fields they want and display it however they feel like. http://www.w3schools.com has good info on DTD and XML.

  17. #17
    SitePoint Addict ibeblunt's Avatar
    Join Date
    Jan 2001
    Location
    Jersey City, NJ
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    w3schools is where I learned XML. Probably one of the better tutorials on XML. However I got bored quick but overall heres what I did learn. The first thing I did was make a brief list of articles found on my site:
    http://www.sohh.com/xml/list_articles.php

    If you look at the source, you'll see it's XML and it uses an XSL stylesheet.
    http://www.sohh.com/xml/list_articles.xsl

    For something more basic like passing 1 article I wrote a script in PHP which pulled content from the database and put it into an XML format.
    http://www.sohh.com/xml/basic_xml_template.php

    Then using a PHP Function I created, createfile(), I wrote the results to my server as an XML file:
    http://www.sohh.com/xml/1.xml

    I have yet to parse anything or do a DTD. I need to finish up that course.
    <///////~

    www.sohh.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •