anchor-cms icon indicating copy to clipboard operation
anchor-cms copied to clipboard

HTML page field results in Uncaught Exception

Open csweichel opened this issue 9 years ago • 12 comments

Summary

Adding a custom page HTML field (called description in my case) and using it in a template, results in an Uncaught Exception:

Uncaught Exception

Class 'Markdown' not found

Origin

anchor\models\extend.php on line 49

Trace

#0 [internal function]: System\Error::shutdown()
#1 {main}

Expected Behaviour

The page field should yield the entered HTML instead of an exception.

Actual Behaviour

It yields the exception as described above.

  • Anchor version: 0.12.1
  • Server setup: XAMPP 5.6.20 (Apache 2.4.17, PHP 5.6.20)

csweichel avatar May 11 '16 12:05 csweichel

To me it looks like the Markdown class hasn't been finished, but I'm not sure? I also replicated this issue within the Articles too. Can somebody with a bit more knowledge of the platform tell me whether using this https://github.com/michelf/php-markdown might be worth looking at?

BenSeward avatar May 14 '16 18:05 BenSeward

@32leaves and @BenSeward, what's the current status of your situations with this? Have you tried updating to the master?

TheBrenny avatar Aug 07 '16 09:08 TheBrenny

I got this error recently. Was there any solution? Cannot find it yet. Thanks

sleepymonday avatar Mar 02 '17 00:03 sleepymonday

@sleepymonday which version are you using? did you download it from the repo?

daviddarnes avatar Mar 02 '17 09:03 daviddarnes

Yes. I did download it from the repo. The version is 0.12.1 Main page of the blog loads correctly, but posts pages get that exact message.

sleepymonday avatar Mar 02 '17 14:03 sleepymonday

@sleepymonday can you post the error you are getting, as the one in the original issue would not be the same as the markdown parser has been changed since it was posted

protomorph avatar Mar 02 '17 16:03 protomorph

captura de pantalla 2017-03-02 a las 14 48 42

sleepymonday avatar Mar 02 '17 17:03 sleepymonday

OK, it's a simple fix, in anchor/models/extend.php find

if( ! empty($extend->value->html)) {
	$md = new Markdown;

	$value = $md->transform($extend->value->html);
}

and replace it with

if (! empty($extend->value->html)) {
	$value = parse($extend->value->html);
}

looks like the bundled release needs to be re-bundled

protomorph avatar Mar 02 '17 19:03 protomorph

Thank you so much ! That fixed it :))

sleepymonday avatar Mar 02 '17 20:03 sleepymonday

@sleepymonday no problem

protomorph avatar Mar 02 '17 20:03 protomorph

@protomorph good work, but is this something that should be added to / accounted for in the codebase?

daviddarnes avatar Mar 03 '17 09:03 daviddarnes

@daviddarnes it's already in both the master and pre-1.0 branches, the release needs to be re-bundled for it to be part of that

protomorph avatar Mar 03 '17 11:03 protomorph