Jump to content

how to use [url][/url] [code][/code] in blog entry form?


foevah

Recommended Posts

Hi everyone I have made my own PHP blog. I would like to make my blog form more advanced so when I wraped [ur|] [/url] around some text it will then be a link on the index page where my blog entries display.

 

I am having trouble doing this..

On the index page I have this code which works for bold tags:

$find[] = "[b]"; //Look for bold tag
    $replace[] = "<span style='font-weight: bold;'>";  //Replace with span tag
    $find[] = "[/b]"; //Look for bold end tag
    $replace[] = "</span>"; //replace with end span

 

I changed the above code to the code below hoping it would work but the browser gave me an error:

$find[] = "[url=http://"; //Look for bold tag
    $replace[] = "<span class="class2"><a href="http://www.experts-exchange.com" onclick="window.open (this.href, 'child'); return false">";  //Replace with span tag
    $find[] = "]"; //Look for bold tag
    $replace[] = "<span class="class2"><a href="http://www.experts-exchange.com" onclick="window.open (this.href, 'child'); return false">";  //Replace with span tag
    $find[] = "[/url]"; //Look for bold end tag
    $replace[] = "</a></span>"; //replace with end span

 

Parse error: parse error, unexpected T_STRING in /home/webmedia/public_html/jecgardner/index.php on line 46

 

Ultimately I would like the links to look like this sites:

http://www.tanfa.co.uk/css/articles/css-borders-design.asp

:o :o

 

Another problem I encountered which is not so serious is the code tag that changes the background colour. I have achieved this but if I add a border to the code it repeats the top border on every new line..

This is a screenshot of what it looks like using a border:

border_code.gif

 

This is the code for the border:

$find[] = "[code]"; //Look for code tag
    $replace[] = "<span style='border-style: outset; background-color:#646464; color: white;'>";  //Replace with span tag
    $find[] = "

"; //Look for code end tag

    $replace[] = "</span>"; //replace with end span[/code]

 

Any ideas how I can get the links to work and fix the border problem?

 

I dont mind trying a new method either!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.