close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

str_replace

Thread began 8/16/2013 9:08 am by Jamie | Last modified 8/17/2013 11:41 am by Jamie | 858 views | 12 replies |

Jamie

str_replace

Hey Jason

Am using the following to rename plain English into a permalink:

$WA_fieldValuesStr = "".((isset($_POST["BlogTitle"]))?$_POST["BlogTitle"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["BlogContent"]))?$_POST["BlogContent"]:"")  ."" . $WA_AB_Split . "".($WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"])  ."" . $WA_AB_Split . "".((isset($_POST["BlogDate"]) && $_POST["BlogDate"]!="" )?date("Y-m-d h:i:s", strtotime(str_replace("/","-",$_POST["BlogDate"]))):"")  ."" . $WA_AB_Split . "".((isset($_POST["BlogTitle"]))?preg_replace('/[^0-9a-z(),]/i','-',str_replace(array("%","!","?","@","\-","/",".","\"","_","\'","*","#"),"",$_POST["BlogTitle"])):"")  ."" . $WA_AB_Split . "".((isset($_POST["Live"]))?$_POST["Live"]:"")  ."";



What am I doing wrong that would make the following Don't let bootstrapping lead to handcuffing make the URL www.domainname.com/blog/don---t-let-bootstrapping-lead-to-handcuffing (ie too many '-' in the word Dont)

Thanks

Jamie

Sign in to reply to this post

Jason ByrnesWebAssist

the relevant part of that line of code is:

php:
((isset($_POST["BlogTitle"]))?preg_replace('/[^0-9a-z(),]/i','-',str_replace(array("%","!","?","@","\-","/",".","\"","_","\'","*","#"),"",$_POST["BlogTitle"])):"")



i bet the probelm is being caused by the magic quotes setting being turned on which adds a forward slash in fron t of the single quote (or actually apostrophe) in "Don't" turning it to "Don\'t"

Try adding stripslashes():

php:
((isset($_POST["BlogTitle"]))?preg_replace('/[^0-9a-z(),]/i','-',str_replace(array("%","!","?","@","\-","/",".","\"","_","\'","*","#"),"",stripslashes($_POST["BlogTitle"]))):"")
Sign in to reply to this post

Jamie

thanks Jason but nope.. hasn'tworked...

edit. have noticed that the blog title that is being added is this Don’t let bootstrapping lead to handcuffing
The blog title is being added through aplain text form input so its not down to formatting...

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post

Jamie

PM

thanks

Jamie

Sign in to reply to this post

Jason ByrnesWebAssist

see PM

Sign in to reply to this post

Jamie

see PM

Sign in to reply to this post

Jason ByrnesWebAssist

copy the quote from your source into the array.

Sign in to reply to this post

Jamie

sorry, not sure what you mean?

Sign in to reply to this post

Jason ByrnesWebAssist

from the document that you are copying the Don't let bootstrapping lead to handcuffing string. Select the Right Single quote, copy that and paste it to the array in the string_replace function.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...