CodeIgniter Forums
CodeExtinguisher Release Candidate 11 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: CodeExtinguisher Release Candidate 11 (/showthread.php?tid=7249)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


CodeExtinguisher Release Candidate 11 - El Forum - 04-11-2008

[eluser]minimal design[/eluser]
is there an easy way to turn off "humanization" of data within fields? It's great to have it for the interface, but I use markdown for the data itself so humanization gets in the way...

I tried to remove it from the autoload but I get:

"Fatal error: Call to undefined function humanize() in /Users/yann/Sites/_projects/minimal_design/codex/application/views/navigation.php on line 5"

I tried removing the humanize() function in the nav but that totally breaks the page without any error message...

Thanks!


CodeExtinguisher Release Candidate 11 - El Forum - 04-11-2008

[eluser]Majd Taby[/eluser]
Where is humanize getting in the way? In the Overview page?


CodeExtinguisher Release Candidate 11 - El Forum - 04-11-2008

[eluser]minimal design[/eluser]
In the formating of the content in the final HTML. The data is saved as humanized in the DB it seems.

For instance you get:

Code:
<p>Some text.<br />
<br />
Some more text.</p>

Instead of:

Code:
<p>Some text.</p>
<p>Some more text.</p>

It makes it hard to fine tune typography/spacing... Markdown is basically much more sophisticated than humanize() and I'd rather have control of how the data is stored in the DB

Thanks!


CodeExtinguisher Release Candidate 11 - El Forum - 04-11-2008

[eluser]Majd Taby[/eluser]
Ah I see, it's not humanize that's causing the problem (so you should undo your changes).

What you want to do is define prepForDb in your plugin. I'm assuming you created/modified your own plugin to get markdown (unless you're simply using the default textarea.

in any case, you want to modify the plugin you are using by defining a function in it as follows:

Code:
function prepForDb($value){
  return htmlentities($value);
}

The above code will simply convert tags into HTML entities.


CodeExtinguisher Release Candidate 11 - El Forum - 04-17-2008

[eluser]minimal design[/eluser]
For some reason I missed your reply... Thanks!

But I don't really understand what you mean. The MarkDown plugin doesn't do anything to the DB, it's parses the code that comes out of the DB, it doesn't interact with the DB at all, I just call it in a view like that:

Code:
&lt;?= markdown($row->content); ?&gt;

I didn't modify anything in my setup, I was entering text via CI scaffolding and the output was fine. But when I installed codex, the posts got extra HTML markup stored in the DB with the text. So I'm not sure how/where I'd implement the code you provided.

Thanks again!


CodeExtinguisher Release Candidate 11 - El Forum - 04-17-2008

[eluser]Majd Taby[/eluser]
I was looking at the code last night and I think I saw it...in table.php (codex/application/views/view_modes/) delete line 176


CodeExtinguisher Release Candidate 11 - El Forum - 04-17-2008

[eluser]minimal design[/eluser]
The problem is not when the content is viewed (it's actually useful to have text humanized in admin area since I only use Markdown for output on site), but when it's inserted in the DB. It's stored in the DB with extra HTML markup. There's some sort of conversion happening when DB is updated.

Thanks for your help!


CodeExtinguisher Release Candidate 11 - El Forum - 04-17-2008

[eluser]Majd Taby[/eluser]
ah sorry, i haven't read your original post in a while...I think your problem is in line 11 of codex/application/plugins/textarea.php (Assuming you're using a regular textarea as your markdown plugin.


CodeExtinguisher Release Candidate 11 - El Forum - 04-17-2008

[eluser]minimal design[/eluser]
Ha... I see... didn't think about looking into plugins... this is probably the culprit:

Code:
function prepForDB($value){
        return (nl2br($value));
    }

I really have to work now... Tongue so I'll test it tomorrow and report back


CodeExtinguisher Release Candidate 11 - El Forum - 04-18-2008

[eluser]tylderdurden[/eluser]
When editing records, i'm getting a lot of this:


An Error Was Encountered

Form Ownership Error.

I haven't restricted access in any way (IE, users can only access their own records), so was wondering what would be a workaround this problem?