get activeTextArea value to Jquery in yii - php

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"));?>

Related

useing $page_title within a echo

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') ?>

Remove a href from php

On my website the following php code displaying a list of items but i would like to remove the hyperlink from each list item.
Could someone please help me with this?
<?php
foreach($features_item as $fet_item){
echo '<li>'.$fet_item->name.'</li>';
}
?>
This will do it:
<?php
foreach($features_item as $fet_item){
echo '<li>'.$fet_item->name.'</li>';
}
?>

Syntax for using echo inside an echo (wordpress slider)

this is the piece of code I'm not sure how to deal with:
<?php echo get_post_meta($post->ID, 'smartslider2', true); ?>
<?php echo do_shortcode('[smartslider2 slider="InsertHere"]'); ?>
I simply want to insert the first echo instead of InsertHere. The first echo should output the content of a custom field. The second should recall the slider with the specific number inserted in the custom field. When trying different possibilities I only get errors.
Can anybody help?
Thank you :)
Don't echo the first value, use it directly inside your second echo.
<?php
echo do_shortcode('[smartslider2 slider="'.get_post_meta($post->ID, 'smartslider2', true).'"]');
?>
Or you can easily put that first value in a variable and use that variable in the second line
<?php $slider = get_post_meta($post->ID, 'smartslider2', true); ?>
<?php echo do_shortcode('[smartslider2 slider="'.$slider.'"]'); ?>

Drupal- Looking for code to print tweet to node-type.tpl.php

I am using the Tweet module in Drupal 7. I need the code to use for printing the tweet field in the node-type.tpl.php. Unfortunately I have been unable to find the correct code to make the link appear in my node. Using contemplate I found the following code;
<?php echo $content['tweet']; ?>
<?php echo $content['field_tweet']; ?>
<?php echo render($content['tweet']); ?>
<?php echo render($content['field_tweet']); ?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#theme'] ?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#attributes']['class'][1]?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#attributes']['class'][0]?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#links']['tweet_Twitter']['html']?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#links']['tweet_Twitter']['href']?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#links']['tweet_Twitter']['title']?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#links']['tweet_Twitter']['title']?>
But none of them work. Anyone have any ideas?
The Tweet module documentation states that it will render in the links section of the node. Add this to node--content-type-name.tpl.php where you want you're tweet links to render:
<?php print render($content['links']); ?>
And clear the cache.

codeigniter inside a php code need to add language type

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.

Categories