Jump to content

roxii

Members
  • Posts

    6
  • Joined

  • Last visited

    Never

About roxii

  • Birthday 09/24/1986

Contact Methods

  • Website URL
    http://roxi.no

Profile Information

  • Gender
    Not Telling
  • Location
    Norway

roxii's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. roxii

    Regex Help

    [!--quoteo(post=377747:date=May 28 2006, 06:34 AM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 28 2006, 06:34 AM) [snapback]377747[/snapback][/div][div class=\'quotemain\'][!--quotec--] An easier solution, maybe... Try to remove ALL the tabs and whitespaces (something like an extended ltrim()) and THEN add tabs. Obviously everything would be "tabbed" automatically and by the same number of tabs, but creating some script that can detect and understand nested tags is not something I am willing, and maybe capable of doing for now. [/quote] Yes, that is what I am using now, but I'm looking for the complex version. I should've noted in my post: only XHTML strict will be used for the tabbing, so any HTML tags ending in [b]/>[/b] can be ignored for nesting.
  2. Try adding this to the top of the index page to see if there are any errors that aren't normally showing. [code] <?php error_reporting(E_ALL); ?> [/code]
  3. I'm not very able with regular expressions, but I have learned a lot in the past few hours trying to get a problem solved. Alas, I am finally stuck. Here's what I'm trying to accomplish: I have several blocks of text separated by at least one line break ("\r\n"). These blocks of text may have zero or more tabs ("\t") in front of them. I am trying to use preg_replace to find all the line breaks and replace them with a minium of [b]$x[/b] number of tabs to get proper HTML tabbing. If [b]$x = 2;[/b] It should turn: [code] <p>A paragraph.</p> <ul>     <li>Element 1</li>     <li>Element 2</li> </ul>                         <p>Another paragraph.</p>                 A freestanding block of text. [/code] into this: [code]         <p>A paragraph.</p>         <ul>             <li>Element 1</li>             <li>Element 2</li>         </ul> <!-- No tabs here because it's an empty line -->         <p>Another paragraph.</p>         A freestanding block of text. [/code] I'm don't fully understand the power of regular expressions, so I'm not sure if something like this is possible. I've been using [a href=\"http://www.regular-expressions.info/characters.html\" target=\"_blank\"]this site[/a] as a resource. If there is a better one out there, I'd like to know about it. This one is faily easy to comprehend even though its organization isn't quite suited for beginners. I'll really appreciate help anyone has to offer.
  4. That's what I'm looking for. Thank you!
  5. It's not the cleanest code, but I think this is what you're looking for. [code] <?php $array = array(122323, 23242, 23524); $ids = null; foreach($array as $match_id) {     $ids = $ids."id!='".$match_id."' OR "; } $ids = rtrim($ids, " OR "); $query = mysql_query("SELECT * FROM table WHERE ".$ids); ?> [/code]
  6. Gah, I never know what to use when I get into this type of situation. I'm using ftp_nlist to gather the files in a directory, but I need to get rid of the path in front of the files. [code] <?php $contents = ftp_nlist($conn, "/public_html/assets/files"); print_r($contents); ?> [/code] That will print out: Array( [0] => /public_html/assets/files/1.jpg [1] => /public_html/assets/files/2.jpg ) All I want is the 1.jpg, 2.jpg, etc. What would be an appropriate function to use to chop off the last slash and everything before it? [b]EDITED BY WILTEEN88: PLEASE USE [ CODE][/CODE] (without the space) TAGS RATHER THAN [code=php:0][/code] TAGS AS PHPTAGS NO LONGER EXIST. THANK YOU.[/b]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.