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

Slug from Title

Thread began 2/12/2013 6:32 am by Daryl | Last modified 2/12/2013 9:16 am by Daryl | 250 views | 2 replies

DarylBeta Tester

Slug from Title

I have been for years trying to get my head round mod_rewrite and Pretty URLs, and the recent email and Davids example has given me the bug.

I am trying to get my head round 'slugs'. I understand the concept and why we need them, but am trying to figure out how to get DataBridge to do this for me.

I have a Title, Introduction and Content field in a form (as well as date, user etc), and then want the Databridge form to send a slug to the slug column which would be a title with hyphens instead of spaces and special characters removed. I assume that this is generated by the title form field but am not sure how I a) alter the title and b) how I get the form to insert the title in to the title column and the modified version into slug as it will be coming from the same form field.

I have been reading this link which gives me the function;

php:
function create_slug($string){

   $string = preg_replace( '/[«»""!?,.!@£$%^&*{};:()]+/', '', $string);
   $string = str_replace( "'", '', $string);
   $string = strtolower($string);
   $slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
   return $slug;
}
$slug = create_slug($title);



But Im not sure where to put this and how to integrate it into an insert form.

Thanks in advance

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...