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 5929151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:23:03+00:00 2026-05-22T14:23:03+00:00

I have 2 tables, page and settings . page is just a bunch of

  • 0

I have 2 tables, page and settings.

page is just a bunch of fields, such as name and slug, and has 3 other fields for meta tags (title, keywords, description) and displays a cms page.

The settings has 3 fields: default_meta_title, default_meta_keywords, default_meta_description

Now what I’m looking to do is to display the default_meta_* tags in the HTML source if the page I am on does not have the particular meta info set from the cms page.

All pages, except the homepage is managed this way, so I was thinking I’d need to add some code to the layout.php to get this to work.

So the homepage will display my default_meta_*, as I cannot set this in the cms pages table.

  • 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-05-22T14:23:04+00:00Added an answer on May 22, 2026 at 2:23 pm

    There are two ways to solve the problem.

    First is to use sfYaml class to update view.yml with default meta tags (see documentation about view.yml). After that if specific page should use another metas you can override defaults with addMeta method of response object

    Second (as ManseUK suggested) is to declare slot placing code like this into layout

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
        <?php include_javascripts() ?>
        <?php include_stylesheets() ?>
        <?php include_title() ?>
        <?php if (has_slot('metas')): ?>
          <?php include_slot('metas') ?>
        <?php else: ?>
          <?php include_component('page', 'metas') ?>
        <?php endif; ?>
    
        <link rel="shortcut icon" href="/favicon.ico" />
      </head>
      <body>
    

    Default metas will be rendered via page components. On top of your template (i guess modules/page/templates/showSuccess.php) place code

    <?php slot('metas') ?>
      <?php if($page->hasMetas()):?>
        <!-- code to render nondefault page metas -->
        <?php echo $page->getMetas(); ?>
      <?php else: ?>
        <?php include_component('page', 'metas') ?>
      <?php endif;?>
    <?php end_slot() ?>
    

    I assume that you will replace $page->hasMetas() with real code that will check if your page object has metatags.

    Actually i would prefer to go further and code page components to accept parameters. Code in a template will look like

    <?php slot('metas') ?>
      <?php include_component('page', 'metas', array('metas'=>$page->getMetas())) ?>
    <?php end_slot() ?>
    

    Deciding which metas (default or not) should be rendered will take place in page components (i assume that you can easily retrieve defaul;t settings from your database). If no parameters were passed (see layout code) than your component should also render default metas.

    I hope this will help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with several tables on it with the same class name.
I have a page that has 4 tables. Initially when the page is loaded,
I have to make edit/create forms for several tables on one page (settings). Therefore
I have two tables, one contains the page/heading number and the heading text, the
I want to place a table on my page. I have two tables in
I have stored page contents (tables, plain text, images and paragraphs) into a variable.
I have two related tables in my database: Page and Tag. One Page can
I have a page with lots of tables, each with a link inside. I
i have a page that displays large datasets into html tables. how can i
I have an HTML page with lot of tables. Among that I have a

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.