We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Extension: MD Markitup custom field type for EE Control Panel - add Markitup to EE!

Development and Programming

Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

Dang, I think I found an issue with this and other Extensions that may also be calling a jQuery file. I may have to rewrite parts of this - or it could be the other extension…

Ugh. I suppose you can never test enough.

       
angstmann's avatar
angstmann
225 posts
17 years ago
angstmann's avatar angstmann

Hi Ryan, yes I set the path to JQuery in the Settings. Tried relative and absolute paths and still no luck, As I said, I have no other extensions running, nor am I using JQuery anywhere else on my server.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Same here. No other extensions set. Tried with a relative path, an absolute path and a hard-coded server path too. None work unfortunately.

Don’t know if that helps though.

Best wishes,

Mark

       
gridonic's avatar
gridonic
231 posts
17 years ago
gridonic's avatar gridonic

Hi Ryan

Installation went fine, I did not have any problems whatsoever. Looks pretty good to me right now, did not have the chance to look at the code and at the set problem, but i guess this could be solved somehow by storing the settings files (sets) for each Markitup editor as text in an extension’s database tables. I’ll try to look into it some time soon.

One problem I had though was that the preview of markitup was not showing the text properly e.g. with no formatting, saving the entry into the database was fine and textile plugin displayed everything nicely.

       
gridonic's avatar
gridonic
231 posts
17 years ago
gridonic's avatar gridonic

Another thing I just spotted by quickly running through the code

$sysfolder = $PREFS->ini('system_folder');

...

<link rel="stylesheet" type="text/css" href="/'.$sysfolder.'/extensions/markitup/skins/markitup/style.css" />

...

This won’t work on production server with no domain assigned yet and a default subfolder like http://www.example.com/~client. The CSS will be included from www.example.com/ instead of www.example.com/~client/.

I’ve seen this in many extensions, the simple solution to this is not to include the files (js, css or whatever) from the “root /” plus system folder, but to include the site_url before the system folder. That way, the site_url setting in your CP will be taken into account.

$system = $PREFS->core_ini['site_url'].$PREFS->core_ini['system_folder'];

...

<link rel="stylesheet" type="text/css" href="'.$system.'/extensions/markitup/skins/markitup/style.css" />

...

Just a thought.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.
One problem I had though was that the preview of markitup was not showing the text properly e.g. with no formatting, saving the entry into the database was fine and textile plugin displayed everything nicely.

I do note on the Markitup page that the preview doesn’t currently work. You need to specify a preview parser path in each set.js file - and I hadn’t even toyed with that yet. It’s the second line down:

previewParserPath:    '', // path to your Textile parser

I did also recommend just turning off the Preview. Note that I THINK the preview works for XHTML. You may only have to specify the path to the Textile plugin here…I’m not sure. If you experiment and find something out about it, I’d love to hear it.

Also, if anyone knows how to fix making multiple-line lists with one click (like you can in the Textile Editor Helper (that’s a different extension) I’d love to incorporate that - but it may just be a shortcoming of Markitup right now).

ADD: I will fix that System folder path issue, too. I know exactly what you mean. The way most exteensions are written that include files, they wouldn’t even work with a masked control panel. Thanks for pointing it out.

       
e-man's avatar
e-man
1,816 posts
17 years ago
e-man's avatar e-man

Awesome, many thanks for this, am testing it out on a new EE-site. Cheers! 😊 edit-add: works like a charm, this makes Markdown even easier to use for end users.

One tip: if you want to disable a button (say H1 and H2 are already are taken in your template), the easiest way is to set the display to none in the style.css file inside your set folder. For example: disabling the preview button… Change:

.markItUp .preview a {
    background-image:url(images/preview.png);
}

to

.markItUp .preview a {
    display: none;
}

This way you don’t have to mess around in the JS file.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Anyone feel like telling me why I can’t get this to work perhaps 😉

Best wishes,

Mark

       
e-man's avatar
e-man
1,816 posts
17 years ago
e-man's avatar e-man

Cried victory too soon I’m afraid. Markdown won’t render links and images properly. For example:

[Your text to link here...](http://www.apple.be "Apple website")

renders in HTML as:

<a href="http://a" title="http://www.apple.be">http://www.apple.be</a> "dsadadasdas">Your text to link here...</a>

In a non Markitup field set to formatting to Markdown I get the same error, which leads me to believe the Markdown plugin is doing something wrong… I’m baffled, any suggestions?

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.
Cried victory too soon I’m afraid.

Yes, DON’T cry victory too soon with this one. 😉

If you are getting the same error, I would assume it is due to the Markdown plugin itself. As I don’t use Markdown, I can’t speak to this. Any Markdown users know about this?

       
e-man's avatar
e-man
1,816 posts
17 years ago
e-man's avatar e-man
Cried victory too soon I’m afraid.
Yes, DON’T cry victory too soon with this one. 😉 If you are getting the same error, I would assume it is due to the Markdown plugin itself. As I don’t use Markdown, I can’t speak to this. Any Markdown users know about this?

On a positive note, I tested the Textile version on the same site and that one works flawlessly. I posted a request for help with the Markdown plugin in the plugin forum as well.

       
e-man's avatar
e-man
1,816 posts
17 years ago
e-man's avatar e-man
If you are getting the same error, I would assume it is due to the Markdown plugin itself. As I don’t use Markdown, I can’t speak to this. Any Markdown users know about this?

Disabling Automatically turn URLs and email addresses into links? in CP Home › Admin › Weblog Administration › Weblog Management › Edit Weblog solves the Markdown problem. That one is sorted then 😊

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

That’s cool - glad that’s solved. I always turn that setting off, so it never would have occurred to me to look at that.

       
Brent Cartier's avatar
Brent Cartier
87 posts
17 years ago
Brent Cartier's avatar Brent Cartier

For those still having trouble getting this to work - I was having the same problem and realized it was because I’m masking access to the control panel using /admin.php

It’s throwing off the path somehow. Try accessing your CP using the actual system folder like:

http://www.domain.com/system/

Hope that helps someone. If any figures out how to enable the preview please share!

P.S. This is one of the the most useful extensions out there. Great work!!!

       
Brent Cartier's avatar
Brent Cartier
87 posts
17 years ago
Brent Cartier's avatar Brent Cartier

Ok here’s how to set up the preview with markdown (should be similar for textile, others):

I created a file called ‘preview.php’ and placed it in the markitup root folder(system/extesions/markitup/preview.php). I also got a copy of markdown.php, and also put it in the markitup root.

Contents of preview.php:

<?php 

include_once "markdown.php";
$my_text = $_POST['data']; //'data' is the default post variable markitup sends the data in.
$my_html = Markdown($my_text);
echo($my_html);

?>

Then in your ‘set’ file (system/extesions/markitup/sets/markdown/set.js) in the first few lines of code, add the previewParserPath and previewAutorefresh settings:

mySettings_markdown = {
    previewParserPath:'~/preview.php',
    previewAutorefresh: true,
        onShi ...etc

previewAutorefresh is optional - but its pretty cool.

Feel free to add your stylesheets etc to the preview.php file. Have fun!

       
1 2 3 4 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.