SEO Links - manually constructed links

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

SEO Links - manually constructed links

Beitragvon Michael_S » Sa 19. Nov 2011, 19:03

Hi,

I have SEO links working but have a problem with links which are created manually. I have a news object and a comment object, on the news detail page the registered customer can post a comment relating to the news item. When the comment is posted the object ID of the news item is registered in the comment object to allow a return link to be created. The reason for wanting a NON-SEO link is to ensure the comment remains linked to the news item if the title changes.

How do I set up my .htaccess file to work with the manually constructed links as illustrated in the code below?

1. Create the comment object including the NON-SEO link as well as the SEO link:

Code: Alles auswählen

<?php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>

<we:object objectseourls="true">
<?php $post_oid = $GLOBALS['we_obj']->ID; ?>
</we:object>

<we:form type="object" id="25" name="comment" method="post" target="_self" categories="/News" classid="3" enctype="application/x-www-form-urlencoded">

	<input type="hidden" name="we_ui_comment[Comment_UID]" value="<we:sessionField type="print" name="ID" />">
	<input type="hidden" name="we_ui_comment[Comment_Username]" value="<we:sessionField type="print" name="Username" />">
	<!-- NON-SEO link -->
	<input type="hidden" name="we_ui_comment[Comment_Post_OID_URL]" value="/<we:path hidehome="true" />?we_objectID=<?php echo $post_oid; ?>">
	<!-- SEO link -->
	<input type="hidden" name="we_ui_comment[Comment_Post_URL]" value="<?php echo $url; ?>">

	<p class="textarea"><we:userInput type="textarea" name="Comment_Body" autobr="true" hideautobr="true" /></p>
	<p class="submit"><input type="submit" value="Submit" /></p>

</we:form>
2. Construct the registered users comment listview matching the comments user ID and the session users ID:

Code: Alles auswählen

<we:condition name="condition">
	<we:conditionAdd field="Comment_UID" compare="=" var="ID" type="sessionfield" exactmatch="true" />
</we:condition>

<we:listview type="object" name="Comment_Listview" order="we_published" desc="true" classid="3" condition="\$condition" objectseourls="true" hidedirindex="true">
	<we:repeat>
		<a href="<we:field name="Comment_Post_OID_URL" />">link</a>
	<we:repeat>
</we:listview>
3. The field Comment_Post_OID_URL = /news/detail.php?we_objectID=128
Production Area
London, UK
http://productionarea.com

mokraemer
Senior Member
Beiträge: 3619
Registriert: So 8. Aug 2010, 01:23
Wohnort: Mainz

Re: SEO Links - manually constructed links

Beitragvon mokraemer » Mi 23. Nov 2011, 02:30

I'm not sure if I fully understand what you want, but maybe this can help, use

Code: Alles auswählen

<we:url type="object" id="..."/>
it would be better if the field "Comment_Post_OID_URL" just contains the id (if possible), so the code could look like this (untested):

Code: Alles auswählen

<we:listview type="object" name="Comment_Listview" order="we_published" desc="true" classid="3" condition="\$condition" objectseourls="true" hidedirindex="true">
   <we:repeat>
<we:field name="Comment_Post_OID_URL" nameto="myurl" to="global"/>
      <a href="<we:url type="object" id="\$myurl"/>">link</a>
   <we:repeat>
</we:listview>
at least since version 6.2.2 (guess) nameto and to is available to most of the tag.
Hope this helps.
webEdition-Kern-Entwickler


Zurück zu „DB / Object Module“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 5 Gäste