Results 1 to 8 of 8

Thread: Counter Not Incrementing - What Gives? [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Counter Not Incrementing - What Gives? [RESOLVED]

    Ok, I don't think I'm a complete gimp, but I'm proly a partial one.

    The background: I want to add a dropcase letter to my website, and I only want it on the first letter of each part, not on every paragraph, so using CSS is out of the question. So, what I'm trying to do is as each section is processed, I grab the content (passed in as $content), grab the first letter and change the markup. The problem is that sometimes the first thing is some HTML. So I want to skip over the HTML, find the first displayable letter, pull it out of the HTML, and then prepend it so that the dropcase is then followed by the rest of the content.

    This should give you an idea of what I'm talking about.

    So, here's my code that I am using:
    PHP Code:
    $newContent trim($content);

    $ltrPos 0;
    $openTag '';

    $first_letter substr($newContent,0,1); // Get the first letter

    if ($first_letter == '<') {
    //The text is marked up and we have an opening tag
    //Need to get past that to find the first chr. Should
    // be able to find it by searching for the matching >
        
        
    while ($firstLetter == '<') {
            while(
    substr($newContent,$ltrPos,1) != '>')
                {
                    
    $ltrPos +=1// $ltrPos + 1;
                
    }
            
    $openTag substr($newContent0$ltrPos+1);
           
    $first_letter substr($newContent,$ltrPos+1,0);
        }
        
    $newContent "<div class='drop-case' id='".$ltrPos."'>".$first_letter."</div>".$openTag.substr($newContent,$cnt+2);
    }else {
        
    $newContent "<div class='drop-case'>".$first_letter."</div>".substr($newContent,1);
    }


    return 
    $newContent
    From what I can tell, my $ltrPos isn't being incremented. I can tell that it's going into the top part, where $first_letter == '<' but it doesn't seem to be going through either of the while loops.

    Can any one see what I may have smegged up?

    TG
    Last edited by techgnome; Jul 24th, 2004 at 08:14 PM.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

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



Click Here to Expand Forum to Full Width