Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION I need add a "href atribute" to CKeditor out format value
#1
hey dude,thanks for your work.

recently i deploy gs for a shopping site

then I need this feature, i dont' know if it's difficult or not.


Quote:ckeditor convert link to
Code:
<a href="http:url">
i need it add an atribute like this  
Code:
<a href="http:url" isconvert="1">
so i didn't need manually input this atribute everytime in "source" edit mode

anyone who can solve this problem for me i am been very apperciate,and promote link back to your site for a thank you. Tongue
Reply
#2
I agree this is sorely needed .  It Appears to be a CKEditor issue actually . 
For people who write an HTML editor you would think this would be a standard  link option Follow or NoFollow when making the link as is is vitally important in managing SEO . 



Quote:ckeditor convert link to
Code:
<a href="http:url">
i need it add an atribute like this  
Code:
<a href="http:url" isconvert="1">
so i didn't need manually input this atribute everytime in "source" edit mode
Reply
#3
Hi, what does isconvert="1" do? I cannot find it via Google

Maybe you can use the GS Shortcodes plugin, using function addlink which you can find in the shortcodes.sample.php.

Then changing it to something like this:

Code:
function addlink($atts, $content = null){
 extract(shortcode_atts(array(
   "src" => null,
   "class" => null,
   "id" => null,
   "isconvert" => null
 ), $atts));
 $class    = isset($class) ? " class='".$class."'" : '';
 $id       = isset($id) ? " id='".$id."'" : '';
 $src       = isset($src) ? " href='".$src."' " : 'src="http://" ';
 $isconvert    = isset($isconvert) ? " isconvert='".$isconvert."'" : '';
 return '<a  '.$src.$id.$class.$isconvert.' >'. do_shortcode($content).'</a>';     
}
add_shortcode('link','addLink', '[link src="" class="" id="" isconvert=""]content[/link]');

You have to copy above code to file shortcodes.php.

you get a shortcode that looks like:
Code:
[link src='' class='' id='' isconvert=''][/link]
Reply
#4
The thread opener has obviously lost interest to discuss his matter. After nearly 4 years, even the best answers won't reach him anymore.

Therefore, I'll try to address frequent questions like his on a more general level. At least if one uses own servers, there is a very simple and elegant way to realize such "feature requests" for your own in a simple and elegant way without even touching the code or integrity of GetSimple itself. (This may also work on shared hosting if certain web server configuration requirements are met.)

I'm talking about Apache's mod_substitute (other webserver software may have similar features). It allows on-the-fly string replacement just before the requested content is sent out, optionally based on simple or regular expression based pattern matching.

To take the opener's request as an example, a simple .htaccess containing the following lines would do the job:

Code:
SetOutputFilter SUBSTITUTE

Substitute 's|<a href="http:url">|<a href="http:url isconvert="1">|nq'

The initial line is only needed once, while there may be any number of substitute directives. Please note the "n" after the closing "|" which tells Substitute to perform simple pattern matching without considering it a regular expression. So this would do a replacement of only one specific pattern on the left side by that on the right side.

For more generic replacements, e.g. for any URL, it could be done by using regular expressions:

Code:
Substitute 's|<a href="([^>]*)>|<a href="$1 isvonvert="1">|q'

The expression within paranthesis means "all following characters up to, but not including the closing >", so it will match any string so far. The respective content will then be represented by the $1 on the right side.


mod_substitute is a very powerful tool and allows all kind of magic and output manipulation while leaving GetSimple itself (or any other content source) completely untouched. Sometimes, the only challenge is to find a pattern which is specific enough to not trigger substitution by unwanted conditions. Another limitation is that replacements can be only done within a "physical" output line, but not across lines. (At least I don't know any way.)
Reply
#5
Thanks, I didn't know this yet. Very interesting.
Reply




Users browsing this thread: 1 Guest(s)