Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7964157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:48:58+00:00 2026-06-04T05:48:58+00:00

I’m trying to ASSIGN dynamically exclusive meta-tags for each page: i.e: url.com/index.php?action=signup Header –

  • 0

I’m trying to ASSIGN dynamically exclusive meta-tags for each page:

i.e:
url.com/index.php?action=signup

Header – Signup Title

Keywords – Signup Meta Keywords

Description – Signup Description

url.com/index.php?action=about

Header – About Title

Keywords – About Meta Keywords

Description – About Description

You got the point.

I’m using arrays…but didn’t figured yet HOW TO ASSIGN each array to each page.

CONF.PHP

<?php
$metas = array( 
'index.php' => array( 
'header' => 'Home Title', 
'keywords' => 'Home Meta Keywords', 
'description' => 'Home Meta Description' 
), 
'signup' => array( 
'header' => 'Signup Title', 
'keywords' => 'Signup Meta Keywords', 
'description' => 'Signup Meta Description' 
), 
'about' => array( 
'header' => 'About Title', 
'keywords' => 'About Meta Keywords', 
'description' => 'About Meta Description' 
) 
);
?>

INDEX.PHP

<TITLE><?php echo $metas['title']; ?></TITLE>
<meta name="description" content="<?php echo $metas['description']; ?>" >
<meta name="keywords" content="<?php echo $metas['keywords']; ?>" >

How to ASSIGN those values to each page???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:48:59+00:00Added an answer on June 4, 2026 at 5:48 am

    You are on the right track 🙂

    Do it in following way:

    <TITLE><?php echo $metas['index.php']['title']; ?></TITLE>
    

    Script name you can get it from the $_SERVER super global array/variable.

    Also from your config.php file remove last 3 lines, you don’t need them.

    Good luck, with PHP make sure you get good knowledge about playing with array. That’s key.

    EDIT:

    $page = 'index.php';
    if ( isset( $_GET['action'] ) && $_GET['action'] != "" )
    {
        $page = $_GET['action'];
    }
    
    <TITLE><?php echo $metas[$page]['title']; ?></TITLE>
    

    EDIT: (on 27th May 2012)

    I think this is pretty much everything:

    Your code in config.php

    <?php
    
    $meta['INDEX']['title'] = "Home page";
    $meta['INDEX']['keywords'] = "kwd1, kwd2, kwd3";
    $meta['INDEX']['description'] = "Home description";
    
    $meta['SIGNUP']['title'] = "Sign up..!";
    $meta['SIGNUP']['keywords'] = "kwd1, kwd2, kwd3";
    $meta['SIGNUP']['description'] = "Sign up description";
    
    $meta['ABOUT']['title'] = "About Company";
    $meta['ABOUT']['keywords'] = "kwd1, kwd2, kwd3";
    $meta['ABOUT']['description'] = "About company description";
    

    Your code in any of your application page/screen (.php files):

    <?php
    
    include "config.php";
    
    // Choice 1: if you want to specify page hardcoded at each page then you can say $page = 'ABOUT' for about-us page and $page = 'INDEX' for home page etc.
    $page = 'ABOUT';
    if( strtoupper($_SERVER['REQUEST_URI'], $page) !== false )
    {
        $title = $meta[$page]['title'];
        $keywords = $meta[$page]['keywords'];
        $description = $meta[$page]['description'];
    }
    // Now you have your meta - use it the way you want
    echo $title;
    
    // Choice 2: If you want to make it little more dynamic
    // Here you don't need to define any hardcoded variable at page level as everything will be considered from the URL being requested
    $page_index = array_keys($meta);
    
    foreach($page_index as $page)
    {
    
        if ( strpos( strtoupper($_SERVER['REQUEST_URI']), $page ) !== false)
        {
            $title = $meta[$page]['title'];
            $keywords = $meta[$page]['keywords'];
            $description = $meta[$page]['description'];
            break;
        }
    }
    // Now you have your meta - use it the way you want
    echo $title;
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.