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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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