Including Only A Small Portion of Original Text

I'm trying to create a <div> tag that will reference a
long article via <?php include()?> but would like for the
<div> container to only show the first few lines or
paragraphs from the included document.
I found an easy way to use javascript to toggle the
visibility of two div tags with unique id's and am trying to create
the first div as a "teaser" or "snippet" of the entire article with
a "Read More" link at the bottom that will hide the snippet and
display the full article.
I'm having a hard time figuring out how to reference only a
small portion of the complete article inside of the first div
element. Is there some way that this might be possible to do?
Reducing the height of the div with CSS does seem to work. Anybody
have any suggestions?
Thanks,
~Greg

Myrrhlin225 wrote:
> I'm trying to create a <div> tag that will
reference a long article via <?php
> include()?> but would like for the <div>
container to only show the first few
> lines or paragraphs from the included document.
>
> I found an easy way to use javascript to toggle the
visibility of two div tags
> with unique id's and am trying to create the first div
as a "teaser" or
> "snippet" of the entire article with a "Read More" link
at the bottom that will
> hide the snippet and display the full article.
maybe you'd better use only one div, and toogle its style via
javascript. In that div, only the
toogle link would need to change.
That would be easier and more efficient in my opinion.
for example, if your div ID is "divID", this javascript
should work:
function toogleDiv(myToogle,theDiv){
var divId = theDiv
if(myToogle == "teaser"){
document.getElementById(divID).style.height = "auto"
document.getElementById("toogleDiv").innerHTML = '<a
href="javascript:;"
onClick="toogleDiv(\'full\',divID)">Read full
article</a>'
}else{
document.getElementById(divID).style.height = "30px"
document.getElementById(divID).style.overflow = "hidden"
// you can add styles to your div using the aboce construct
document.getElementById("toogleDiv").innerHTML = '<a
href="javascript:;"
onClick="toogleDiv(\'teaser\',divID)">close</a>'
and in your HTML:
<div id="someId">
<p id="toogleDiv"><a href="javascript:;"
onClick="toogleDiv('teaser','someId')">Read full
article</a></p>
<?php include(yourtext.txt); ?>
</div>
>
> I'm having a hard time figuring out how to reference
only a small portion of
> the complete article inside of the first div element. Is
there some way that
> this might be possible to do? Reducing the height of the
div with CSS does seem
> to work. Anybody have any suggestions?
>
> Thanks,
> ~Greg
>
seb ( [email protected])
http://webtrans1.com | high-end web
design
An Ingenious WebSite Builder:
http://sitelander.com

Similar Messages

  • GZipStream Decompression only returns small portion of original file

    I've been trying to use GZipStream to decompress a file originally created with gzip (default settings).  The gzipped file inflates to one file of 5,120,001 KB (~5GB) using gzip -d.  There are no errors and the inflated file matches the original
    byte-for-byte.
    Using the GZipStream to inflate the file with the exact code from Microsoft's example for .NET 4.5 (the Decompress() method) produces a file with roughly the first 500 MB of the original input file.
    I've found some evidence online that others have encountered this problem before and Microsoft says it's been fixed in the latest version of .NET but, using VS 2013 Premium with Update 4 and .NET 4.5.2, I still can't recover my file.  No error, the
    .CopyTo() method just returns.  The code does work for smaller gzip files (~2KB).
    Is this really working for files larger than 4GB?  If so, what do I need to do, please?  If not, well, ditto.
    Happy Holidays to all and thanks for any help.

    Dear Fred,
    Thank you for your response.  The compressed file comes from a UNIX server that used gzip to deflate a large (5GB) text file.  Let's call the original file LARGE.TXT and the deflated file LARGE.TXT.GZ (the names are immaterial but help exposition). 
    LARGE.TXT is 5,120,001 KB and LARGE.TXT.GX is 479,502 KB.  Gzip and WinZip have no difficulty inflating the deflated file and the result is LARGE.TXT in both cases.
    The code is straightforward.  betterName is just a more descriptive name for the output file (fileToDecomress.Name if some great, long, system generated name from the original Unix server).
    public static void Decompress(FileInfo fileToDecompress, string betterName)
    using (FileStream originalFileStream = fileToDecompress.OpenRead())
    string newFileName = betterName.Remove(betterName.Length - 3);
    using (FileStream decompressedFileStream = File.Create(newFileName))
    /* (1) */ using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress))
    decompressionStream.CopyTo(decompressedFileStream);
    Running this produces a file, call it LARGEfragment.TXT, that is roughly 512MB or the first ~10% of LARGE.TXT.  That is, ~90% of LARGE.TXT is missing in LARGEfragment.TXT but the text that is present, is correct.
    Smaller gzipped files (that inflate to ~1GB), say SMALL.TXT.GZ, from the same server are inflated by the above code to SMALL.TXT exactly as expected.  Files of about 2K also work fine.  Thus, it seems the class works properly except for large files. 
    I have about 10TB of these large files to inflate and work with - almost all are 5+ GB when inflated (the server splits logs into 5GB chunks, gzips them, then archives them).  None of the large files I've tried work - all of the smaller ones I've
    tried do work.
    I tried replacing /* (1) */ in the above code with the DeflateStream class:
    /* (2) */ using (DeflateStream decompressionStream = new DeflateStream(originalFileStream, CompressionMode.Decompress))
    This produced a "Block type not recognized" error.
    It's strange.  GZipStream is based on zlib now and so is the Unix gzip.  zlib can work with arbitrary file sizes (up to 16 exabytes, I believe) as long as the "long" type on the system used to compile zlib is 64 bits.  If "long"
    is only 32 bits, file size is limited to 4GB.  Might this have anything to do with it?
    Please let me know if you need more information.
    Thanks again and Happy Holidays!

  • Trying to download new Garmin map which may take a few hours and Firefox times out after only a small portion has been downloaded, unless I sit here and move the mouse occationally. Can we stop Firefox from timing out?

    Trying to download new Garmin map which may take a few hours and Firefox times out after only a small portion has been downloaded, unless I sit here and move the mouse occasionally. Can we stop Firefox from timing out? edit

    Quote from: lcwhitlock on 04-April-14, 13:44:09
    Hello darkhawk,
    Thank you for the recommendation.  I somewhat understand what a MS DOS disk is, but I'm not sure how to go about creating one. I've seen where you can use a program, like Rufus, to create a usb one  - but I'm leery about using 3rd-party programs (especially ones I'm not familiar with). I've come across a couple of 'how-to' tuts, but they didn't clarify what files (if any) I would need to include on the disk (for my particular situation). Right now I don't have any blank cds, nor any extra flash/thumb drives - wish I did, but hadn't needed these for years. There has only been one other time where I needed to re-install Windows, but that was over 15 years ago - I did it through BIOS, reformatting my drives, and then reinstalled via the Windows XP disk. Windows 8 is an entirely different breed, which has left me feeling a bit stumped, at times. If there was a way I could perform it (successfully), similar to the first time I did it years ago, I'd give it a try - but at the same time, I'm a bit reluctant, because if it doesn't work, then I'm stuck without any internet access to get further help.
    Ask and ye shall receive. This should be doable in Windows 7 and Windows 8 on another PC. I recommend using a USB Flash drive like in this tutorial, but I'm sure you could use something else.
    If you want, you could also use Hiren's BootCD to make a bootable CD with many options and programs on it (I keep one, just for certain situations) that will allow you to do the same things.
    http://www.hiren.info/pages/bootcd
    Also very useful for sorting out virus's as long as it's downloaded and made on another PC that is virus free......

  • Print (&preview) only prints small portion of page

    When I use print preview, I see only a small portion of the upper left hand corner of the page, and if I try and print, that's exactly what prints.
    I can scale down smaller to see the entire page, but it is still displayed in that small corner, and when printed is also reduced in size.

    Thanks for response.
    I should have added that I had tried that reset you suggested earlier, and now that entry isn't there any more. But it didn't help.
    Then, just now I tried the third suggestion in the list. Everything was as it should be, right sized paper, no multiple pages/sheet, etc.
    BUT, without changing anything, when I went back to try it again, it seems to be fixed.
    I'm a little more confused, but I'll take a win no matter how I get it. ;-)

  • Only a small portion of my photos in Photo Stream on my iPhone go to the cloud then to my iPad. I only have 150 pictuures so it can be a capacity issue??  Any advice ?

    Only a small portion of my photos in Photo Stream on my iPhone go to the cloud then to my iPad. I only have 150 pictuures so it can be a capacity issue??  Any advice ?

    OK, so it's working the way it is supposed to. With any device that is retrieving photo stream photos from the cloud, it will only retrieve back to the time that photo stream was turned on for that device.
    Now that you have it turned on, any photos you take will show up in photo stream for either device from now on.
    Hope that helps!
    Cheers,
    GB

  • When I AirPrint it only does small portions of the page. How do I get it to print the whole page?

    When I AirPrint The printer only prints a portion of the page.  How do I get it to print the whole page.

    It would help if you stated what printer you are using and what application you are doing the printing from. Also, what are you printing?

  • HT201317 my iphone 5c broke and was replaced today, but only a small portion of pictures tranferred to the new phone. Please help me get the rest of my pictures back on my phone

    my pics did not transfer to my new iphone 5c icloud

    Use your computer's backup to transfer your iTunes library from your old computer to your new computer per the instructions included with this link, or do the same with both computers networked in some fashion, which shouldn't be hard to do if both computers are connected to the same wireless network.
    http://support.apple.com/kb/HT1751

  • Why do only a small portion of my photos get synced to my PC?

    I setup iCloud when it first came out over a year ago. My iCloud says that there are 2gbs+ of photos there, but when I try to sync them back to my PC, only photos that I've taken since about a month ago get synced back, which is about 30mbs worth of data. There is obviously a lot more photos sitting in the cloud somewhere, how do I get them back to my PC!! I'm using the guide given on the Apple website that involves the iCloud control panel, but it just isn't working. Please let me know how I can fix this or a different way to get my photos back.

    Hi Bewildered User,
    Here is an article about Photo Stream that may help explain what is going on:
    iCloud: Photo Stream FAQ
    http://support.apple.com/kb/ht4486
    How long are My Photo Stream photos stored in iCloud?
    The photos you upload to My Photo Stream are stored in iCloud for 30 days to give your devices plenty of time to connect and download them.
    This article has different methods for importing your photos:
    iOS: Importing personal photos and videos from iOS devices to your computer
    http://support.apple.com/kb/ht4083
    Cheers!
    - Ari

  • My mouse doesn't work properly, only a small corner works most, i have had it less then a year

    I have had my laptop for less then a year, and the majority of the time, only a small portion of the mouse works, how do I fix this, or is there someplace I can take it for warranty work.

    Hey there Rac5,
    It sounds like your iPod Nano 7th gen is not turning on suddenly. I would use these troubleshooting steps from the following article named:
    iPod nano (7th generation): Hardware troubleshooting
    http://support.apple.com/kb/TS4433
    Will not turn on or screen remains dark
    Connect iPod to power for at least ten minutes to ensure that the battery has enough charge to allow iPod to turn on.
    If iPod does not turn on after ten minutes, try resetting it while it is still connected to power. Reset the iPod by holding down the Sleep/Wake button and the Home button for at least six seconds or until you see the Apple logo appear.
    If the Apple logo appears on the display, connect iPod to a computer and verify that it appears in iTunes and can play music. If iPod appears in iTunes and can play music, no further troubleshooting is needed.
    If the screen remains dark and will not turn on, then your iPod may need service.
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • Green Screen - need to bring back a small portion of clothing

    I shot some video against a green screen and the talent wore a green shirt under a black jacket. It is only a small portion of what she was wearing and the shirt never touches the green screen. Is there a way to only ultra key contiguous green or a way to  bring her shirt back in after it is keyed out. It is only about a 30 second video and not a lot of movement.
    thank you

    It sounds like you did it the right way. Or, rather, the easiest, most common way.
    It is possible to take the video, mess with the levels until you get all black or white, and use that as a mask. If you reduce the mask a bit you can avoid messing up any edges.
    The advantage of that is that you don't have to keyframe. But that only works with some video. If there are soft edges like hair it won't work very well. But for clothing it is usually OK. Sometimes the movement is so radical that creating a mask out of the video itself can be a real time saver.

  • HT2486 the photos that I add to address book will only be there for a few seconds after I close the edit button. Either they go away completely or they a very small portion of the actual photo

    the photos that I add to address book will only be there for a few seconds after I close the edit button. Either they go away completely or they are very small portion of the actual photo

    Frank, thanks for your note.  I wrote "COMPLETED" because I had gone to a lot of effort to get the content of the book precisely as I wanted it. I would fully expect to see my level of effort and care matched by functional competence in Aperture 3 to render the book the way I created it.  Too much to ask?
    And yes, I upgraded the Aperture 2 Library first.  [Not ALL my tens of 000s of pix, because I use Lightroom selectively for photo editing. But Yes to the Aperture 2 Library.]  That step took a number of minutes, but seemed to work fine (no error messages of any kind).
    Then I opened the existing book project in Aperture 3, which followed some "magic-box" process that took a minute or so.  As I said, when that step was done, by all appearances the book was ready to submit for printing - until I examined the photos a little more closely.  You did see the blurry example I included, didn't you? That is what each and every photo looks like.
    Text-box content appears to have been rendered pertectly, for the record (including captions).
    So, ... is this result something you have heard of before?  Do you know of a one-step solution?  Or am I looking at an extended picture-by-picture fix?

  • In putting together a book I can move photos onto a page and enlarge the picture but is there a way to reduce the picture size? some cases I want a smaller picture and if I change the size of the picture box I only get a portion of the image. I wnt to red

    picture size...in putting together a book I can move photos onto a page and enlarge the picture but is there a way to reduce the picture size? some cases I want a smaller picture and if I change the size of the picture box I only get a portion of the image. I want to reduce the image to fit the size of the box.

    If you right click on the image on the page in the context menu select photo box alignment and then select one of scale to fit {centered, Left-aligned, Right-aligned}
    That should do what you are loking for.

  • I typed in data into the highlighted text box, and then tried to print my form.  However, when printed, the copy only showed a portion of my answer.  Is there a way to expand Adobe Reader's highlighted text to show my full response, or should I make my re

    I typed in data into the highlighted text box, and then tried to print my form.  However, when printed, the copy only showed a portion of my answer.  Is there a way to expand Adobe Reader's highlighted text to show my full response, or should I make my responses only as long as the highlighted portion allows?

    While printing any pdf file it will print the visible text only. To overcome this, the form needs to be dynamic so that it expands in layout while entering more data. Usually dynamic forms are developed by Adobe LiveCycle Designer.
    ~Deepak

  • How can I recognise the text in only the top portion of a page?

    I am using Acrobat XI Pro and wish to recognise the text in only the top portion of a page.  The document is made of of pages of music and I only want to be able to search the title section of each page.  Recognising the text in the body of the music makes it difficult to search and find each piece.  How can I apply Text Recognition to only the top portion of each page?  And if possible how do I apply this to multiple pages simultaneously?
    The other option I considered was separating each piece into its own file.  However it is convenient for me to have all the pieces in one file if possible.

    Thanks Test Screen Name,
    Yes, "zoning".  I can stop trying now.
    Thank you

  • Where are these unix executable files coming from and how do I recover the original text file?

    where are these unix executable files coming from and how do I recover the original text file?

    When you upgraded to Lion did you have AppleWorks installed on your mac?
    Most of the AW documents can be opened by Pages 09 or Numbers 09 with most of the orginal format in tact. (I do not know if previouse verision will work) just open the AW file with both and see which one works best.
    Text Edit will also open most of the AW files as well but will require a lot of work to restore them to their orginal format.
    If you have AW Database documents then they are not supported. 
    These document show up as "exec icons", Kind: Unix Executagle File.
    They also will show up as .cwk file if they are small files. I have a couple that were under 1mb that are shown as " Kind: AppleWorks Document" but will not open.
    The only option to open AW database is to have AW installed on a mac with a pre-Lion OS to recover the file.

Maybe you are looking for

  • Client dependent and client independent in ALE

    I am going through pdf learning of an ALE scenario,i couldnot get wat is meant by client Independent and client dependent. How can i conclude Create message type (WE81){color:green} Client independent {color} To create a new message type, follow thes

  • Credit Card Payment Processing

    Dear Experts, We are implementing CRM and need your help to crack below D2C Scenario :- While booking the Sales order, Customer gets charged on his/her Credit Card (prepayment). The sales order then flows to R/3 and subsequent processes viz. Pick/Pac

  • Changing Order of Songs in Album-iTunes 12

    Like the title says, how do I change the order of songs in a album? Before you could use get info and sort by track number. Thanks

  • Need help with my SL

    hello ladies and gents, i got a zen sleek and a love it only thing that sucks is the lack of assessories. my question is...is there any way to hook up the sleek to you car audio system with using a cassette adapter or FM transmitter. by the way i do

  • XMLType inputstream on OCI client

    Hi all, I have a problem using XMLType.createXML in java to create a XMLType to use as parameter in a stored procedure using OCI client (it works with thin client). my environment (sorry if I missed something!): Oracle db 11.1 on server, Java 1.6 and