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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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