PHP help, should be simple

lee101

VIP Member
OK, i am writing a blogging/news/content management script but have got stuck, at nearly the end of it, i havedone everything to manage and write all the stuff but i have an annoying problem here, i'll try to explain as bets as i can:
$content_update is the variable for the content submitted from the form, using a wysiwyg editor (openwysywig), that all works fine, but when the form is submitted it replaces all thei quotes - " with \" , which would normally be fine but they are showing up whin the file is viewded, ie if i wanted "hello" it is showing up like \"hello\", but if i manually remove the \'s ti works fine, so i thought i could use str_replce to replace \" with " before it is written to the file, but i don't really get how it works, could someone please explain it, i have tried
PHP:
str_replace('%\"%','%"',$content_update);
butit just doesn't work, i don;t really understand the str_replace function, could someone please help me with this, as it is really annoying me,

Thanks, Lee :D
 

dragon2309

P.I Dragon
hi lee... been looking at the code snippet there, 15th character along you have a \, i cant personally see what this is for... ive looked intot the str_replace function and other examples do not ahve this \

for example, this:
PHP:
str_replace("%body%", "black", "<body text='%body%'>");
would end up printing out <body text='black'>

Take it from there, play about with it, make sure you keep a backup of it.

i suggest changing your code to read:
PHP:
str_replace('%"%','%"%',$content_update);
dragon
 

lee101

VIP Member
ahh, thanks, i've got it now, i just put what i wanted replacing into variables, so it now looks like
PHP:
//sort out the quote problems
$old='\"';
$new='"';
$title=str_replace($old,$new,$title);
$content=str_replace($old,$new,$content);

i'm now stuck getting openwysiwyg to work in FF, can't anything just be simple

edit: the \ is part of whati wanted replacing, i wanted \" to be changed to "

Lee :D
 
Last edited:

dragon2309

P.I Dragon
glad you got that sorted out..... but i think you may have hit a brick wall, can i have a link to this editor or something, if it doesnt work with FF then you will have to redesign, and redesigning means starting from scratch, ill do a bit of searching on this openwysiwig and see what comes up

dragon

*EDIT* ok, on their site i found this, what version of FF are you running, it si cross-browser compatible, works with damn near anything, lol

Cross-Browser Compatible
  • browsers.gif
    openWYSIWYG is compatible with the most popular internet browsers, meaning your users will have no trouble making use of it. These browsers include: IE 5.5+ (Windows), Firefox 1.0+, Mozilla 1.3+ and Netscape 7+.
 

lee101

VIP Member
i don't really know what was wrong with openwysiwyg, i don't think it liked the fact that thepages were xhtml, i removed the doctype at the top and it worked, but thatmessed someof the css in IE, so i guess i'lll just live with what i have it at at the moment - working!

Lee :D
 

lee101

VIP Member
i really wouldn't have a clue where to start to debug the css, i think i will just leave it as it is, it still functions the same and works well anyway, the bit of css that doesn't work is
#wrapper{
margin:0 auto;
width:700px;
}

and for the sake of aligning centrally i can;t be bothered to fiddle at the moment

Lee :D
 

dragon2309

P.I Dragon
lol, ok, fair enough, syntax of that css is fine, so i dont see why its not working... is this project live or is it in development still, i would like to see it in action...

draogn
 

lee101

VIP Member
sorta still in development, i let a friend have it to find out if there was any problems, and there were quite a few, i'll upload a demo of it now to somewhere, as far as i know it is all working fine, just the positioning of the whole thing, but at least it's consistent

**note to self: annoy parents until they allow me to get webhosting**

Lee :D

edit: here are the links for it, it's hosted on my pc, i gave up waiting for it to upload toa really slow server, then having to mess baout with permissions,
http://84.64.50.54/blogsimple_wysiwyg_demo/blogsimple/ - the admin panel
http://84.64.50.54/blogsimple_wysiwyg_demo/ - show only the a few of the entries (however many are configured in the admin panel)
http://84.64.50.54/blogsimple_wysiwyg_demo/display_all.php - show all the entries

and i have plans to do:
rss feed generator
a wap, mobile phone admin panel
photo album type thing
something that will create the home for you, so you don't even have to mess about making your custom page to display everything
and something that makes it easy to turn into a CMS

and i was hoping to put al these as kind of "extensions", so you would download the basic thing first, then just add what you wanted when you wanted,, simply by copying and pasting it, or **another idea** i could make an extensions manager script, that would look on the website for extensions available, then you could upload them from there

Lee :D

edit 2: i forgot to say it won't be online all the time, as it's on my pc i turn it off at night
 
Last edited:

lee101

VIP Member
Rambo said:
Exams in June / July :(
argh, please don't remind me, i've just finished maths coursework, and i tihnk i have the exams for it at the end of may :(x2

but it's online now :p
Lee :D
 

lee101

VIP Member
should be working now, i had to reset my router eralier and it must have lost all the settings

Lee :D
 
Top