News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

[SOLVED (againx2)] - BBcode to link to images as mouse over?

Started by anewhobby, November 11, 2009, 07:03:34 PM

Previous topic - Next topic

anewhobby

Oh.. I just ran into a small problem that you may now how to fix... it is not to big a deal... but if you use punctuation the variable breaks...

example - Victoria's Lost  appears as Victoria039s Loft in the post and is looking Victoria039s Loft.jpg

Is there a way to be able to use apostrophes in the card name title?

Arantor

Argh, I forgot apostrophes.

array(
'tag' => 'c',
'type' => 'unparsed_content',
'content' => '<a class="screenshot" rel="$1.jpg">$1</a>',
// !!! Should this respect guest_hideContacts?
'validate' => create_function('&$tag, &$data, $disabled', '$data = preg_replace("/[^a-zA-Z0-9\'\ \-]/", "", str_replace("'", "\'", $data));'),
),
Holder of controversial views, all of which my own.


anewhobby

thank you... but....

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/x/x/x/x/x/xx/xx/Sources/Subs.php on line 1053

When you try to refresh the page (

(just put x's to hide absolute url

Arantor

ARGH BUG IN SMF.

str_replace("'", "\'", $data

The ' in the first pair of quotes is NOT an '.

It should have been the following without the spaces:
& # 3 9 ;
Holder of controversial views, all of which my own.


anewhobby

I am sorry i do not understand your answer....  :( thanks for helping as always though.. but if you have time to restate that ... ?

Arantor

There's a bug in SMF.

In the code I gave you, it states str_replace("'", "\'", $data)

After that bracket you see two quotes containing an apostrophe. It shouldn't be an apostrophe. It should be & # 3 9 ; instead, but I can't give you the text exactly because it gets converted to an apostrophe, so you have to turn it into:

array(
'tag' => 'c',
'type' => 'unparsed_content',
'content' => '<a class="screenshot" rel="$1.jpg">$1</a>',
// !!! Should this respect guest_hideContacts?
'validate' => create_function('&$tag, &$data, $disabled', '$data = preg_replace("/[^a-zA-Z0-9\'\ \-]/", "", str_replace("& # 0 3 9 ;", "\'", $data));'),
),


You just have to take the spaces out.
Holder of controversial views, all of which my own.


anewhobby

#46
ahhh.. great... thanks... but still one more problem lol.. sorry this is just dragging on isn't it...

anyway... now that you have corrected me on that the apostrophes are showing up in teh text of the post.. but the image link is broken.. I assume from the same problem as with the bbcode... but something needs to be changed in the javascript code at the top?

If it displays fine in the forum I can name the cards on the server to match the botched javascript call if this can nto be fixed... (assume I cna find out what the boatch file name it is asking for is)

<---- EDIT

Fix for Apostrophes

In Line of javascript code
$("body").append("<p id=\'screenshot\'><img src=\'', $settings['theme_url'], '/cards/"+ this.rel +"\' alt=\'image preview\' />"+ c +"</p>");

Replace
"+ this.rel +"

With
"+ escape(this.rel) +"

Arantor

I'd actually gone to bed before seeing your later post, so I'd forgotten there would be a knock-on effect here.

Still, seems that a solution was found, and in the best way actually.
Holder of controversial views, all of which my own.


anewhobby


Arantor

I saw - many thanks to you for that, it is appreciated :)

Let me know if you need anything else for this, or any other tweaks.
Holder of controversial views, all of which my own.


anewhobby

man with any luck we are done with this :) heh heh... I mean.. a full card image mod would be awesome... with a database of  the cards and all that would be great but this works fine.

Now I just need to get a "rating system" set up so people can rate the decks people upload.

Arantor

Well, as I said I looked at doing something like that for MTG (including a deckbuilder application I had partly built, which was cool for tracking how many cards a user had), but it is an awesome amount of work.
Holder of controversial views, all of which my own.


Advertisement: