Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   PHP/Perl/Web (https://thetfp.com/tfp/tilted-technology/109217-php-perl-web.html)

Jinn 10-04-2006 09:52 AM

PHP/Perl/Web
 
Has anyone ever written a script to automatically give a brief description of the document? One of the sites I'm working on is a newspaper, and I have to manually grab the headline and first 5 or 6 lines and use that as the "teaser." Would there be any way to automate this? I don't think I could guarantee that every article would have the same number of lines between headline and body text.

Similarly, I use a PHP script to insert an article into the center div in my page. Unfortunately, if the page is really long, when it inserts the article it doesn't jump back to the top of the page. I can't really use #id tags, because the base document never changes - just one div is re-filled.

Any suggestions?

robot_parade 10-04-2006 05:46 PM

Well, yes, this sort of thing is certainly possibly, but it kind of depends on what your 'inputs' are. Do you have some text already available locally, or do you need to get them from a web page, or?

Assuming the second option, the perl module usually used for this is 'LWP'. Such things are non-trivial for someone new to perl, but certainly doable.

Jinn 10-05-2006 06:57 AM

They're all local - for example:

I've got entertainment-1.htm, entertainment-2.htm, entertainment-3.htm, and entertainment-4.htm. I want to make a file named entertainment.htm that has the headline and first paragraph of each file, followed by a link.

Entertainment.htm:

entertainment-1.htm headline
First couple lines of entertainment-1.htm

link to entertainment-1.htm

entertainment-2.htm headline
First couple lines of entertainment-2.htm

link to entertainment-2.htm

noodles 10-06-2006 09:04 AM

Quote:

Originally Posted by JinnKai
They're all local - for example:

I've got entertainment-1.htm, entertainment-2.htm, entertainment-3.htm, and entertainment-4.htm. I want to make a file named entertainment.htm that has the headline and first paragraph of each file, followed by a link.

Entertainment.htm:

entertainment-1.htm headline
First couple lines of entertainment-1.htm

link to entertainment-1.htm

entertainment-2.htm headline
First couple lines of entertainment-2.htm

link to entertainment-2.htm

just logically set up the documents in some standard format, possibly with xml, and make the main page with php or some other language (at your leisure), which will either open and parse the file, or include the xml, and then display it appropriately. doesn't sound too tough to me.

Jinn 10-07-2006 03:49 PM

............


All times are GMT -8. The time now is 01:34 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76