Search

Spotted that one.

@alpacaaa - Is there anyway to tweak this current extension to allow to resave entries and convert all textarea fields that are set to HTML to Markdown text (with Markdownify)? If so, would you mind giving me some pointers on how to get that done?

Unfortunately, I'm a PHP/Javascript moron. Any tips would be welcome.

Is there anyway to tweak this current extension to allow to resave entries and convert all textarea fields that are set to HTML to Markdown text (with Markdownify)?

I think this mechanism could be abstracted to build some sort of a "filters system" that accepts some fields as input and returns processed output, according to the selected filters.

Very handy extension, except it doesn't work with the Multilingual field :(

@Pat can you be more specific? It seems to work on my side.

@Brian + @Simone That might be the best solution, being able to define a php callback which is invoked before saving each entry. Will look into that.

I've just pushed some changes that should make markdown conversion possible.

You are now able to specify a php callback and eventually save the code in callback.php if it's not already defined anywhere else.

Here's a quick how to for Brian:

  • Checkout the latest repo code.
  • Make sure you have the XMLImporter extension installed, as it ships with markdownify.
  • Open extensions/resave_entries/callback.php and paste this code http://pastie.org/2094839.
  • Discover your textarea's field_id. There are several ways, if you're stuck just let me know.
  • Change the $field_id in callback.php accordingly.
  • Run the re-save process specifing toMarkdown as callback.

That should do, let me know how it goes!

Man I had a great idea while I was asleep this morning (yes, I dream in Symphony. I know, you don't have to say it)...

This could be the basis for a really cool field increment that globally increments, say a price field.

Sometimes prices may need increasing or decreasing by a certain amount, and this would be a great way of doing it. It's gonna need some JS to dynamically create the field list based on the chosen section, then have an input to add the amount (either as a number, or negative number) then clicking go would pull each entry, find the field, do the math and resave the entry!

If only I knew how to get the field list with JS... Any ideas?

Now that a php callback is availbale, such a level of frontend mess could be avoided, so you can get straight to the point (coding the php logic).

@alpacaaa - Marco, you are genius!!!!! That worked perfectly.

NOTE: I used @nickdunn's Entity Diagram extension to get the ID textarea field ID.

@alpacaaa - Marco, in some of my sections I have multiple textareas that I need to convert. Is it best change the callback.php file and resave that same section multiple times? Or is there a that I can call multiple field ids? Is that possible? Would that be an array? If so, what would that look like?

Glad it worked :)

This might work with multiple textareas.

@alpacaaa - Marco, you are simply amazing! The array works as well!!! Thank you so much, this is SO helpful. You have save us days of work!!! Thanks for this awesome extension and extending it's functionality even further! Wow!

Awesome!

I'm trying to resave a few sections (without a callback) and I always see this message:

Processing 1 of NaN

Marco, do you have an idea what's wrong here?

Check the response of the AJAX request that should be in your console. I presume it will contain a PHP error...

Check the response of the AJAX request that should be in your console. I presume it will contain a PHP error...

yep

Great. Found the culprit (a problem related to SSM). Thanks!

Good! ;)

Hi,

I have created a new formatter. It works well for new entries, but older entries has still the same older formatted format.

How could I resave just the textarea of my section taking just the right format ?

Have a look at the solution posted for Brian a while back.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details