Demo

Probiere ClanSphere aus und teste daran herum. Demo


Antworten: 2
Seite [1]
microz


Rock the board




Beiträge: 86
# Thema - 29.05.2009 um 13:52 Uhr
Hello,

I am trying to add some lines to "abcode" to easier to put a link to download.

currently "i change [ for { in this post"

{url="http://misite.com/files/file.zip"}{img}http://misite.com/ima ges/download.jpg{/img}{/url}

Only thing is that it is not static file.zip, so it would be easier:

{url2}file.zip{/url}

did this, but only sees the picture and the link is wrong, any suggestions please?

 
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
1. / 2. / ... 

<?php
 
function cs_abcode_url2($matches) {
    if (
$matches[0] == '[/url2]') {
        
$return cs_html_div(0);
    }
    elseif(empty(
$matches[1])) {
        
$return cs_html_div(1,0,0);
    } 
    else {
        
$name '<div align="center"><a href="http://misite.com/files/'.$matches[1].'"><img src="http://misite.com/images/download.jpg" alt="Download" /></a></div>';
        
$return    $name;
    }
    return 
$return;

    
$replace preg_replace_callback("=\[url2\](.*?)\[/url2\]=si","cs_abcode_url2",$replace);
?>



grettings
Inaktiv
duRiel ClanSphere Team


Weltmeister




Herkunft: Cambridge
Beiträge: 7300
# Antwort: 1 - 29.05.2009 um 14:08 Uhr
hi,
you could simply do it this way:

 
1.
2.
3.
4.
5.
6.
1. / 2. / ... 
<?php
function cs_abcode_url2($matches) {
        
  return 
'<div align="center">[url=http://misite.com/files/'.$matches[1].'][img]http://misite.com/images/download.jpg[/img][/url]</div>';
}
?>


you have to move the replace more to the top then so that the [img] tags will be found later.

greetings
duRiel


Inaktiv
|
microz
Thread-Ersteller


Rock the board




Beiträge: 86
# Antwort: 2 - 29.05.2009 um 22:25 Uhr
thanks works perfect


Inaktiv
|

Dieses Thema wurde von SCHIRI ClanSphere Team PM geschlossen.

Antworten: 2
Seite [1]