Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> <?php ?> Marking Up With Php, How to simply add HTML tags with PHP
Rating 1 V
matak
post Jun 5 2007, 10:24 AM
Post #1


Super Member
*********

Group: Members
Posts: 413
Joined: 4-October 06
From: Psychedelic Realms
Member No.: 31,079



Just a simple function to mark your queries smile.gif

CODE
<?php
$uzorak = 'Hosting credit';
//use post to get $uzorak variable

$tapeti = "Hosting credits are collected by posting at the forums. The hosting credits are given after your posts are filtered and depending on its size, you get proportional hosting credits. Once you get the required credits you can post an application for hosting. One of our admins will then approve your application after which you can register an account at http://www.trap17.com/process Do not try to spam and collect Hosting credits. Any methods of spamming will not be tolerated. Your Account will be banned if you are caught spamming. After you get hosting, you will have to maintain your hosting credits by staying active. Remember the amount of posts has no effect on Hosting Credits. We look for Quality rather than Quantity.";
//use file get contents to get $tapeti variable

$tagovi    = array();

work    ($uzorak, $tapeti);
function    work($uzorak, $tapeti)    {

$duzina        = strlen($uzorak);
$velicina    = strlen($tapeti);

$b = array();
$a = 0;
while    ($a <= $velicina){
$newstr    =    substr($tapeti, $a, $duzina);

if ($newstr == $uzorak){
    $tagovi[]= $a;
}
elseif ($a == $velicina && !empty($tagovi)){
    uredi_tagove($tagovi, $tapeti, $duzina);
}
elseif ($a == $velicina && empty($tagovi)) {
    echo "sorry no matches found";
    break;
}
$a++;
}
}
function uredi_tagove($tagovi, $tapeti, $duzina){
    
    $newstring ="";
    $count = count($tagovi);
    $nextchar = 0;
    for($i = 0;$i<$count;$i++)
     {
        $newstring .= substr($tapeti,$nextchar,$tagovi[$i]-$nextchar);
        $newstring .= "<strong>". substr($tapeti,$tagovi[$i],$duzina) ."</strong>";
        $nextchar = $tagovi[$i]+$duzina;
     }
     $newstring .= substr($tapeti,$nextchar);
     print $newstring;
}


?>


You can see it in action here. Just search for something (note: it might not always work as it's rather simple f-ion) smile.gif

If you want to work with me on a certain project just send me a PM wink.gif

This post has been edited by matak: Aug 3 2007, 04:25 PM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Html Frames(7)
  2. Html Font Tags In Php(11)
  3. Executing Scripts Without Include() Function(3)
  4. Best Php/html(2)
  5. Parsing .html Pages(9)
  6. Html Within Php Coding(11)
  7. Php And Asp.net Form(6)
  8. Finding Data In Meta Tags(0)
  9. Adapting Html Code Embed To Work On Phpnuke(7)
  10. Parsing Html As Php(7)
  11. Php And Disabling Html Tags(11)
  12. Logging Dowload Files From Your Server Onto A Html File(1)
  13. [help]: Php To Html (static) Converter(3)
  14. A Script To Close All Bbcode Tags In Php(1)
  15. Help With Moving Html Form Results To Shopping Cart?(3)
  1. Script To Translate Into Bbcode From Html Tags(1)
  2. Html Site With Login(2)
  3. Html Code Tester. Online Script(15)
  4. File Checker-how To Check File Whith Html Through Html?(2)
  5. How Do I Get The Result To "stick" And Add Html Tags?(14)
  6. Html Form!(4)
  7. Weird Formatting: Embedding Php Into Html(9)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 11:21 PM