TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-12-2010, 01:28 AM   #1 (permalink)
r0b
The Visitor
 
Join Date: Sep 2010
Posts: 3
Thanks: 1
r0b is on a distinguished road
Default Flatfile-edit in place CMS

Hey everyone, I'm finishing up a free project and there's probably one line of coding bugging me.

The cms can be viewed right here (working demo). Password is admin.

What I'm trying to do is hide the <br> in the textarea field. Not disable it, but only make it invisible for the user editing the content. (You can view the <br>'s by logging into the admin panel and clicking anywhere on the content).


So far I've tried

PHP Code:
$content=nl2br($content);

and

$content = str_replace("<br>", "\n", $content);

and

<?php
  
echo "<pre>";
  echo 
$file1;
  echo 
"</pre>";
?>
All without success.

Anyone has any ideas left?

I'm using these libraries if it helps anyone:
- http://ajax.googleapis.com/ajax/libs.../jquery.min.js
- http://krneky.com/wondercms/js/editInplace.js
- http://krneky.com/wondercms/js/wkrte.js
- http://krneky.com/wondercms/js/jquery-1.3.2.min.js

Last edited by r0b : 09-12-2010 at 01:59 AM.
r0b is offline  
Reply With Quote
Old 09-12-2010, 05:24 PM   #2 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

Nice concept, I've seen it starting to crop up and I sort of like it for smaller less-content heavy site.

I'll take it as a mistake but the first and last libraries you've listed are both jQuery 1.3.2 following that you might want to upgrade to 1.4.x, it has some great new features.

your editInPlace.js file has it's own XMLHttpRequest class, this is a bit superfluous if you're using jQuery, it already provides great ajax utilities and jQuery also provides event binding. I'm sure implementing your own solutions was great practice and gained you some valuable insight into the nuances of cross-browser javascript development but try not to re-invent the wheel. This along with a Software Engineer's habit of over-engineering solutions are probably the #1 time wasters in development.

So, it's nice, it's simply & I'm sure it'll be more than suitable for smaller sites where the Webmaster simply wants to easily edit their content.
__________________
My Blog
Enfernikus is offline  
Reply With Quote
The Following User Says Thank You to Enfernikus For This Useful Post:
r0b (09-12-2010)
Old 09-12-2010, 05:38 PM   #3 (permalink)
r0b
The Visitor
 
Join Date: Sep 2010
Posts: 3
Thanks: 1
r0b is on a distinguished road
Default

Thank you very much for your comment and opinion. Feedback and constructive criticism are always the best.

I would never of noticed that I'm using two same libraries, thank you, I'll change and update this to 1.4.2 in a minute.

Right now I'm only trying to finish this up, as it is a "one-mand-band" project and it's hard to keep up with everything.

*Edit*

Updated with jquery 1.4.2.

Last edited by r0b : 09-12-2010 at 06:28 PM.
r0b is offline  
Reply With Quote
Old 09-13-2010, 07:48 PM   #4 (permalink)
r0b
The Visitor
 
Join Date: Sep 2010
Posts: 3
Thanks: 1
r0b is on a distinguished road
Default

The CMS is now available free for download: WonderCMS

The problem was fixed by changing:

Code:
function editBox(actual) {
if(!changing){
width = widthEl(actual.id) + 20;
height =heightEl(actual.id) + 2;
actual.innerHTML = "<textarea?"
changing = true;
}
actual.firstChild.focus();
}
to

Code:
function editBox(actual) {
if(!changing){
width = widthEl(actual.id) + 20;
height =heightEl(actual.id) + 2;
str = actual.innerHTML;
actual.innerHTML = str.replace(/<br>/gi, "");
actual.innerHTML = "<textarea?"
changing = true;
}
actual.firstChild.focus();
}

Last edited by r0b : 09-13-2010 at 08:18 PM.
r0b is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add, delete, edit page working for each table automaticly Peuplarchie General 0 05-30-2010 02:24 AM
Making an edit script... rguy84 General 2 08-19-2009 06:15 PM
Edit posted form content & if isset quesion Peuplarchie Advanced PHP Programming 1 11-09-2008 10:34 PM
Best Place to buy domains? ETbyrne The Lounge 19 10-26-2008 04:47 AM
Edit php.ini within PHP ETbyrne General 5 08-16-2008 12:35 PM


All times are GMT. The time now is 11:57 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design