Hai everybody,

i have two different layout.
this admin layout meta tag not display in my meta title,description..
what is the problem
and
i addded my action file inside,but not diplayed.

plz help me.

    public function executeContactus(sfWebRequest $request)
    {
    $this->setLayout('adminlayout');
    $response = $this->getResponse();
    $response->setContentType('text/html');
    $response->addMeta('title','Contact Us – Give us your feedback, comments and questions');
    $response->addMeta('title','Talk to us. We would love to hear from our users on how we can improve to provide the best plan sharing experience.');

    }


<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name = "viewport" content = "width = 1080" />

        <meta name="title" content="symfony project" />
        <meta name="description" content="Social Network  sharing." />
        <meta name="keywords" content="S Catalog, Reservation, Advertisement" />
        <meta name="language" content="en" />
        <meta name="robots" content="index, follow" />

        <link rel="stylesheet" type="text/css" href="../css/reset.css"/>
        <link rel="stylesheet" type="text/css" href="../css/admin.css"/>

        <link rel="shortcut icon" href="/favicon.ico" /> 
        <script language="JavaScript" type="text/javascript" src="../js/jquery.min.js"></script>





        <script>



        </script>

        </head>  



    <body>

`

Dani AI

Generated

Quick diagnosis and concise fix: calling addMeta('title', ...) twice will replace the first value with the second, and addMeta('title', ...) only creates a meta named "title" — it doesn't set the HTML <title> tag by itself. Use the response's setTitle() to set the page title and addMeta() for description/keywords. As noted, two identical meta keys overwrite each other; choose one method per purpose or add logic per page. (symfony.com)

Recommended action-side pattern (set the title and description from the action):

<?php
// example inside an action
$this->getResponse()->setTitle('Contact Us — Give us your feedback');
$this->getResponse()->addMeta('description', 'Talk to us. We would love to hear from our users.');
// set the layout if needed: $this->setLayout('adminlayout');
?>

Make sure the admin layout actually prints the response metas and title. The layout's <head> should include the symfony helpers that output HTTP metas, regular metas and the <title> tag, for example:

<head>
<?php include_http_metas() ?>
<?php include_metas() ?>
<?php include_title() ?>
<?php include_stylesheets() ?>
<?php include_javascripts() ?>
</head>

If dynamic values still do not appear, verify that the adminlayout file used by setLayout() contains those helpers (no hard-coded title/meta that masks them), that setLayout() is called before rendering, and clear Symfony's cache after changes. For module-wide or static defaults, consider view.yml instead of setting everything in the action. The Symfony view docs explain how addMeta(), setTitle() and the include_* helpers interact and note that adding an existing meta key replaces it by default. (symfony.com)

What are you asking? Are you asking about the addMeta() functions? If you are, look at what you are doing? You are overwriting the first function with the second. If you need to have them displayed on two different pages try adding some logic.

if( is_some_page() ){
$response->addMeta('title','something');
}else{
$response->addMeta('title','something');
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.