I want this to work, it doesn't currently, so, if its possible, what do I need to change:
<?php echo $page_title_LEADER; ?>
In the config file I have
define('ENGLAND_LEADER', 'Bob Smith:');
define('SPAIN_LEADER', 'Stan Smith:');
which when I use:
<?php echo ENGLAND_LEADER; ?>
works fine as you would expect, what I'm trying to do is use the page title to auto fill the COUNTRY name part of COUNTRY_LEADER, so I don't have to manually change the name of the country each time.
NB I do have the $page_title set in the page
You can use the constant function for this
<?php echo constant($page_title . '_LEADER') ?>
Related
I want to use my index.php page as my template for all my other pages. So I'm printing it out with the code below.
echo file_get_contents("index.php");
I've added this piece of code into the template (index.php) where i want to display the contents. of whichever page im on.
<?php
echo $index_content;
?>
So when I use
echo file_get_contents("index.php");
to get my page template, on for example users.php. In the users.php file I want to use the code below
$index_content = echo "string";
to then print out my page contents where I added this variable
<?php
echo $index_content;
?>
My problem is when I say $index_contents = echo ("string");
it's not printing anything out. onto my template. or it prints the stuff out but at the end or the beginning of the template. not where i've inserted my variable. Why wont it echo out my stuff where I've inserted my variable.
file_get_contents() give you the source of your file.
If I get you right you want to use include instead. Also don't echo in a variable but assign the value and echo it in the template.
users.php:
$content = 'what ever';
include 'template.php';
other.php:
$content = 'other page';
include 'template.php';
template.php:
echo $content
If you call users.php output will be "what ever". If you call other.php output will be "other page".
You are storing the return value of "echo" in $index_content, which is empty.
Just omit the echo when assigning the string to the variable.
The other problem is, with file_get_contents you don't evaluate the php expression where you echo out the $index_content.
Instead, you should use include('index.php') in users.php, and set the variable $index_contents before that.
I am new in Yii.
I have a view file with following code
<?php echo CHtml::beginForm(); ?>
<?php echo CHtml::activeTextArea($model,'adremarks');?>
<?php echo CHtml::submitButton('Swap',array('id'=>'swap'));?>
<?php echo CHtml::endForm(); ?>
I want to access the value of text area to my script, here my jQuery script
var adremarks= $("textarea#adremarks").val();
alert(adremarks);
But I cant get the value there, Is this the right way else how can I get a text area value to script
Thanks in advance
The problem is your activeTextArea does not have html ID. You need to add id in this way:
<?php echo CHtml::activeTextArea($model,'adremarks', array("id" => "adremarks"));?>
I'm displaying a gallery on my wordpress site using the following code:
<?php echo do_shortcode('[satellite gallery=2 auto=off caption=off thumbs=on]'); ?>
Now I've added a custom post value/field called 'guitLink' where I can add the gallery number which I want to then use in the above shortcode, so something like this:
<?php echo do_shortcode('[satellite gallery=' .get_post_custom_values('guitLink'). 'auto=off caption=off thumbs=on]'); ?>
Any ideas how to achieve this?
Use:
<?php $guitLink = get_post_custom_values('guitLink');
echo do_shortcode('[satellite gallery=' .$guitLink[0]. ' auto=off caption=off thumbs=on]'); ?>
Instead of
<?php echo do_shortcode('[satellite gallery=' .get_post_custom_values('guitLink'). ' auto=off caption=off thumbs=on]'); ?>
Currently in the PHP file it has:
<?php if($myfooter_text){?>
<?php echo of_get_option('footer_text'); ?>
<?php } else { ?>
something else here
<?php } ?>
What I would like is for it to insert the footer text it finds using $myfooter_text but also add a link to the end of whatever has been pre filled in the footer text. I tried to use concatenation with the following:
<?php echo of_get_option('footer_text') . 'mylink; ?>
However this still just shows the predefined footer text and not the additional content. Is there a way to do this? I'm aware it could be added in the footer area of the dashboard but this isnt what i want to do.
Try it like this:
<?php echo of_get_option('footer_text'); ?> mylink
You can concatenate them as well like this or do it your way and be sure you close all the quotes:
<?php echo of_get_option('footer_text') . 'mylink'; ?>
this is the code where it load my dynamic menu
<?php echo $this->dynamic_menu->build_menu('1'); ?>
this is the code for my language type
<?php echo lanchor($uri, lang('menuenglish')); ?>
here i wanto to add like this
<?php echo $this->"<?php echo lanchor($uri, lang('menuenglish')); ?>"->build_menu('1'); ?>
i know the uper code is wrong but for makeing it clear..
instead of the dynamic_menu i wanto to echo from my language varaiables
one of my language variable inside the dymanic menu
regards
Just do this :
<?php
$menu = lanchor($uri, lang('menuenglish'));
echo $this->{(string) $menu}->build_menu('1');
?>
But if you search for this in Google, you will be able to find the answer.