Jump to content

I want to collect code html at one variables PHP in one code!


Mahmoud

Recommended Posts

 I want all the variables and the name of the files to be changed in the same code and not to create more than one code because it appears on all pages that it is empty.

    <meta name="keywords" content="{if $filename eq "index"}{$LANG.keywordsindex}{elseif $filename eq "shared-hosting"}{$LANG.keywordshosting}{/if}" />
    <meta name="description" content="{if $filename eq "index"}{$LANG.descriptionindex}{elseif $filename eq "shared-hosting"}{$LANG.descriptionhosting}{/if}" />
    <!-- Start Meta Page -->
    <meta name="keywords" content="{if $filename eq "index"}{$LANG.keywordsindex}{elseif $filename eq "ssl-certificates"}{$LANG.keywordsslcertificates}{/if}" />
    <meta name="description" content="{if $filename eq "index"}{$LANG.descriptionindex}{elseif $filename eq "ssl-certificates"}{$LANG.descriptionsslcertificates}{/if}" />

    <meta name="keywords" content="{if $filename eq "index"}{$LANG.keywordsindex}{elseif $filename eq "email"}{$LANG.keywordemail}{/if}" />
    <meta name="description" content="{if $filename eq "index"}{$LANG.descriptionindex}{elseif $filename eq "email"}{$LANG.descriptionemail}{/if}" />

Link to comment
Share on other sites

use this ActionHook point to specify these variables values and pass it to your template, in your case the action hook file would look like:

<?php

add_hook("ClientAreaPage", 1, function($vars){
	global $_LANG;
	$metakeywords = "";
	$metadescription = "";
	
	// Specify Homepage Meta Tags
	if ($vars['filename'] == "index"){
		$metakeywords = $_LANG['keywordsindex'];
		$metadescription = $_LANG['descriptionindex'];
	}
	
  	// apply the same for other pages...
	if ($vars['filename'] == "xyz"){
		$metakeywords = $_LANG['xyzindex'];
		$metadescription = $_LANG['xyzindex'];
	}
  
	return array("metakeywords" => $metakeywords, "metadescription" => $metadescription);

});

then in your template it should look like this:

{if $metakeywords}<meta name="keywords" content="{$metakeywords}" />{/if}
{if $metadescription}<meta name="description" content="{$metadescription}" />{/if}

 

Link to comment
Share on other sites

2 minutes ago, sentq said:

use this ActionHook point to specify these variables values and pass it to your template, in your case the action hook file would look like:


<?php

add_hook("ClientAreaPage", 1, function($vars){
	global $LANG;
	$metakeywords = "";
	$metadescription = "";
	
	// Specify Homepage Meta Tags
	if ($vars['filename'] == "index"){
		$metakeywords = $LANG['keywordsindex'];
		$metadescription = $LANG['descriptionindex'];
	}
	
  	// apply the same for other pages...
	if ($vars['filename'] == "xyz"){
		$metakeywords = $LANG['xyzindex'];
		$metadescription = $LANG['xyzindex'];
	}
  
	return array("metakeywords" => $metakeywords, "metadescription" => $metadescription);

});

then in your template it should look like this:


{if $metakeywords}<meta name="keywords" content="{$metakeywords}" />{/if}
{if $metadescription}<meta name="description" content="{$metadescription}" />{/if}

 

Do you allow me to tell you just one thing I Love Youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated