emina
(Emina Hasanovic)
1
Hi,
I’m trying to make menu with links who are pointing on a specific sections of a single static page. I found way how to add links to that sections:
CHtml::link('Section',array('/site/page', 'view'=>'static_page', '#' => 'section'))
But now, I don’t know how to tag that specific section, like it’s done simple with plain html, for example:
<a href="#emina">Emina section</a>
....
<a name="emina"> This is the section about Emina. </a>
<-- this!
Here is definition of the method link:
public static string link(string $text, mixed $url='#', array $htmlOptions=array ( ))
Based on the definition above, you can do something like this:
CHtml::link('Section',array('/site/page', 'view'=>'static_page', '#' => 'section', array('name'=>'emina')))
emina
(Emina Hasanovic)
3
Yes, I got that already, but my question was how to tag that specific section in page, so when I click on that link, he redirects me to that section.
If you are on the page A and you want to link something withing the page A, you can use something like this:
echo CHtml::link('Contact',array('', '#' => 'contact'));
The section link itself:
echo CHtml::link('Contact',array(), array('name'=>'contact'));
If you are on the page A, and you want to link something on the page B, you can do something like this:
Put this code on the page A:
echo CHtml::link('Contact',array('controller/action', '#' => 'contact'));
Put this code on the page B
echo CHtml::link('Contact',array(), array('name'=>'contact'));