/    Sign up×
Community /Pin to ProfileBookmark

how does the VB code works

I am building some king of blogging software ?. But I have disabled <>. Now if I would like to put a link on my context I will have to use VB code. I have seen something like that on this forum and I have a question how can I acomplishe that. I would also like to put an immage on my page but because my script disable the use of < and > i cannot write <img …..>

Now I need some explanations about VB code – how to use it and hot to change it in to the ordinary html.

if I put in my context on blog [url*] [url]http://www.domain.com[/url][/url*] (* is used to display what I would like to edit in the VB tags -> hope you understand ? )
I would like to get in my file something like this:

<a href=”http://www.domain.com”>[url]http://www.domain.com[/url]</a>
I also looking fo some kind of solution for the immages.

Thx for any help on this case!!

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@JonaApr 24.2004 — [font=arial]You'll want to run some code to replace the VB code with its relevant HTML [b]after[/b] you disable the < and > characters; if you do it the other way around, you will not be able to use VB code. I would suggest [url=http://php.net/preg_replace]preg_replace[/url] for this.[/font]
Copy linkTweet thisAlerts:
@WebfreakauthorApr 25.2004 — I trying to put something together with instructions from Jona. But I am not successful. :p . Is there anyone who will be willing to help me with some sort of script how to replace [url*] and similar VB tags?. Or is there any working script where I could learn how to replace this kind of tags?

Thx all!!?
Copy linkTweet thisAlerts:
@NevermoreApr 25.2004 — Assuming you variable is called $blog:

$blog = preg_replace( &quot;/[b](.+)[/b]/&quot;, &quot;<span style='font-weight:bold;'>1</span>&quot;, $blog );

$blog = preg_replace( &quot;/[u](.+)[/u]/&quot;, &quot;<span style='text-decoration:underline;'>1</span>&quot;, $blog );

$blog = preg_replace( &quot;/[i](.+)[/i]/&quot;, &quot;<span style='font-style:italic;'>1</span>&quot;, $blog );

$blog = preg_replace( &quot;/[p](.+)[/p]/&quot;, &quot;<p>1</p>&quot;, $blog );

$blog = preg_replace( &quot;/[url=(.+)](.+)[/url]/&quot;, &quot;<a href='1'>2</a>&quot;, $blog );

$blog = preg_replace( &quot;/[img=(.+)](.+)[/img]/&quot;, &quot;<img src='1' alt='2'/>&quot;, $blog );

$blog=str_replace(&quot;n&quot;,&quot;<br />&quot;,$blog);

$blog=str_replace(&quot;n&quot;,&quot;&lt;br /&gt;&quot;,$blog);
Copy linkTweet thisAlerts:
@WebfreakauthorApr 25.2004 — First thx every one!

I have tryed with what the cijori posted for me (thx that helps a lot) but I still have a problem with this.

If I put in variable only one [b*] text [/b*] works great. But if I put in my text two the same [b*]bold text[/b*]some other text [b*] bold text [/b*] I get the problem. All text is bold. I have no idea why but I dont like that ? . If any one could give me a right direction what to do I would be realy grateful.
Copy linkTweet thisAlerts:
@NevermoreApr 25.2004 — My code works for me, are you sure you're closing the tag properly? The only error in the code seems to be the URL code, which should have been:

$blog = preg_replace( "/[url=(.+)](.+)[/url]/", "<a href='1'>2</a>", $blog );
Copy linkTweet thisAlerts:
@WebfreakauthorApr 25.2004 — Ok here is the code that I have put together :rolleyes: .

[upl-file uuid=970f2cac-9766-4c7d-a299-d8c057e94e57 size=555B]test.txt[/upl-file]
Copy linkTweet thisAlerts:
@PittimannApr 26.2004 — Hi!

I am playing with a chat script which also was supposed to have something like you want. Due to some problems, I couldn't work on that point before now. A part of what I made for my script is in the attached txt file. Hope it helps...

Cheers - Pit

[upl-file uuid=47f009bd-118d-48a9-b02a-df9989ec493b size=938B]webfreakvbcode.txt[/upl-file]
Copy linkTweet thisAlerts:
@NevermoreApr 26.2004 — Here's a demo of my code; seems to be working. It will give you formatted HTML code (with HTML entity encoding to make it visible) when you input VB code.

http://www.deiform.co.uk/vb.php

It contains a link to the source.
×

Success!

Help @Webfreak spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...