close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Insert SEO title in combination with Insert_ID

Thread began 5/20/2015 5:52 am by marcel303333 | Last modified 5/21/2015 2:04 pm by Ray Borduin | 3343 views | 8 replies |

marcel303333

Insert SEO friendly title in combination with Insert_ID

I have difficulties with a insert form.

I would like to insert a SEO capable title (titletext-titletext-titletext) and append the Insert_ID (titletext-titletext-titletext-Insert_ID).

How do I do append the Insert_ID?

Thanks for your help in advance.

Marcel

Sign in to reply to this post

Ray BorduinWebAssist

I don't quite understand the question. Are you inserting into a database? Is this a new record in the database or are you updating an existing record?

Why are you appending the Insert_ID and where is the Insert_ID coming from?

I need to get a better grasp of what you are doing so I can give the appropriate solution.

Sign in to reply to this post
Did this help? Tips are appreciated...

marcel303333

Sorry, not be clear enough.

I'm trying to insert a new record in the database for a CMS content. I have a form with title, content text, etc. I would like to create automatically the title to use as url (title text title text => title-text-title-text). I created a function for this which works pretty well. To be sure there is no duplicate entry, I wanted to append the ID of the entry. I thought I could manage to integrate the variable you use for redirection [Insert_ID]. This obviously does not work.

I could manage the problem with update but not with insert a new record.

Any idea?

I hope I was a little bit clearer now :-)

Sign in to reply to this post

Ray BorduinWebAssist

The Insert_ID is the value of the unique key generated when the insert takes place. It can't be appended at the time of insert because it doesn't exist until after the insert.

You can always append the unique key from the database when displaying the record. Why is a unique value important when inserting?

Sign in to reply to this post
Did this help? Tips are appreciated...

marcel303333

The unique value is important because I want to use it as ID for the purpose of a SEO friendly URL. For this reason it must be unique.

http://www.domain.de/nachricht/legionellen-im-trinkwasser-122/

instead of

http://www.domain.de/nachricht/122/

Sign in to reply to this post

Ray BorduinWebAssist

You could still append the ID to the SEO friendly URL and parse it out to display the record from it. Just filter based on the parsed id rather than the title.

Sign in to reply to this post
Did this help? Tips are appreciated...

marcel303333

This could be the solution for my problem.

Do you have an example of how to do this? How do I parse it out?

This is the code I use for: http://www.domain.de/nachricht/122/

$colname_content = "83";
if (isset($_GET['id_cms'])) {
$colname_content = $_GET['id_cms'];
}
mysql_select_db($database_webcocms, $webcocms);
$query_content = sprintf("SELECT webcocms_content.id_cms, webcocms_content.id_verkn_cms, webcocms_content.sort_cms, webcocms_content.titel_cms, webcocms_content.text_cms, webcocms_anmeldung.Vorname, webcocms_anmeldung.Nachname, webcocms_content.visible_cms, webcocms_content.insert_cms, webcocms_content.update_cms FROM webcocms_content INNER JOIN webcocms_seiten ON webcocms_content.id_verkn_cms = webcocms_seiten.id_seite INNER JOIN webcocms_anmeldung ON webcocms_content.verfasser_cms = webcocms_anmeldung.Nr WHERE webcocms_content.id_cms = %s AND webcocms_content.id_verkn_cms = webcocms_seiten.id_seite AND visible_cms = 1 ORDER BY webcocms_content.insert_cms DESC", GetSQLValueString($colname_content, "text"));
$content = mysql_query($query_content, $webcocms) or die(mysql_error());
$row_content = mysql_fetch_assoc($content);
$totalRows_content = mysql_num_rows($content);

.htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(admin|kundenportal|zaehlerablesung)
RewriteRule ^([^/]*)/$ ?id=$1 [L]
RewriteRule ^([^/]*)/([^/]*)/$ ?id=$1&id_cms=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]
Options +SymLinksIfOwnerMatch

Sign in to reply to this post

Ray BorduinWebAssist

It looks like you are passing the reference to the page using: id_cms

So you can strip the id off the end of it with (assuming you add a dash and the id to the end of the links):

php:
<?php

$_GET
['Unique_ID'] = substr($_GET['id_cms'],strrpos($_GET['id_cms'],"-")+1);
?>



Then you can filter the recordset with the 'Unique_ID' url parameter which will have the value of the stripped off id from the end of the link.

Sign in to reply to this post
Did this help? Tips are appreciated...

marcel303333

Thank you Ray!!

It works like a charm!

Sign in to reply to this post

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