Jump to content

Get META


Geoserv

Recommended Posts

I have a site where people can submit content from other websites.  In step 1 they enter a URL and my script fetches the URL title and displays it on step 2.  It then shows boxes for the user to enter the description, tags, category.

 

I am trying to get the script to fetch the meta description and display it in the description box already shown where the user can edit or enter more info.

 

php:

if ( preg_match ( '~<meta(.+?)name="description"(.+?)>~i',  $this->html, $matches ) )
{
  $description = preg_replace( '~^(.+?)content="([^"]+?)"(.+?)$~i', '$2', $matches[1].$matches[2] );
  echo $description;
}

 

then in my .tpl file:

 

<textarea name="bodytext" rows="10" cols="55" id="bodytext" WRAP=SOFT onkeyup="if(this.form.summarycheckbox.checked == false) {ldelim}this.form.summarytext.value = this.form.bodytext.value.substring(0, {$StorySummary_ContentTruncate});{rdelim}textCount er(this.form.summarytext,this.form.remLen, {$StorySummary_ContentTruncate});">{$description}</textarea>

 

but its not displaying the description here.

 

It puts it above my content.  For example these forums come up as:

 

PHP Freaks Forums - Index

 

You can see in action at http://www.newsdots.com/submit

User: Geoserv

Pass: raven3

 

Any ideas what I am missing?

 

Geoserv.

Link to comment
https://forums.phpfreaks.com/topic/89536-get-meta/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.