i'm trying to create an anchor to a page's element. There's a tab interface. In html i can see that their links are like this:
http://example.com/index.php/service#tab-1
http://example.com/index.php/service#tab-2
http://example.com/index.php/service#tab-3
http://example.com/index.php/service#tab-4
So that i have 4 div's with id's tab-1,tab-2 etc.
How can i create anchor to them from another view file? When i try this:
give it a try
it goes to page /service but not focused on #tab-1 . It was working on plain html, but i couldnt do it with codeigniter
Thanks for help!
I just tried the same thing on my CodeIgniter and it worked fine so I suggest double checking your IDs are correct. Other than that try
give it a try
or
give it a try
You need to put the target of #tab-1 etc. in your page. So in your div you need to include a named anchor such as:
<a name="tab-1"></>
This will cause the page to jump to this element.
Related
In Codeigniter, I have a database containing a link of a site.
Each item(event) has a link to the event page.
Site
But instead of going to the desired site, it just adds the link to the existing url like this: http://web.site.local/index.php/evenementen/www.referedsite.com
when checking the html code it shows the following:
Site
Does anyone know how to make it go to www.referedsite.com instead of making it add this to the existing link?
You need to put HTTP://
Site
In codeignitor you can use
echo anchor('', 'Site');
// Prints: Site
Read CI Anchor
try
Site
I'm trying to figure out how to have a hyperlink that will add a new/additional GET variable to the URL, but will not remove any existing GET variables or anchor tags. So, if my URL is any of the following:
http://example.com/index.html?color=blue
http://example.com/index.html?color=blue&type=shirt
http://example.com/index.html?color=blue#reviews
...and I click the link, such as:
Large
... the URL should be updated to:
http://example.com/index.html?color=blue&size=large
http://example.com/index.html?color=blue&type=shirt&size=large
http://example.com/index.html?color=blue&size=large#reviews
Right now, if I make a link as above, it will remove all existing GET variables and anchor tags from the existing URL.
What's the fix?
You can do something like:
Large
See QUERY_STRING.
much like Samsquanch's answer but try replacing SERVER with GET
Large
Hi, I want to redirect my page to another website, I used anchor tag but when I click on this it will add my website name also
http://au.pricecomparereview.com/www.theiconic.com.au/Rococo-Textured-Mini-Skirt-113532.html
Please tell me about this . I am new in php I am using oscommerce
www.theiconic.com.au/Rococo-Textured-Mini-Skirt-113532.html
use like this, you may be missing http://
www.theiconic.com.au
If you want a PHP approach try this:
// Declare url variable
$url = "http://www.theiconic.com.au/Rococo-Textured-Mini-Skirt-113532.html";
// Use it to create the <a> with php
echo "www.theiconic.com.au";
Or with html use the PHP assing tags:
www.theiconic.com.au
I think your anchor tag would be like this presently:
www.theiconic.com.au
Change it to
www.theiconic.com.au
and it will work fine.
I have a redirect function which works, and inside it I'm using a variable that tells it where to link to.
redirect_to($url);
For a couple times I need to use this function, however, I want it scroll down to a certain div id on the page, which I think is usually something like:
scroll to comments
I just don't know the proper way to combine that with the php function I'm using above. Everything I've tried just gives me a syntax error.
Any help would be greatly appreciated!!
If you have an anchor defined try:
$anchor = '#comments';
redirect_to("{$url}{$anchor}");
Give it anchor an id then ur redirect will be 'header("url#idname")
Not sure if this is possible but wanted to know if htaccess has a trick...
Say I have anchor tag href like this -
Click here
I have changed the URL structure using mod_rewrite but wanted to know if i can hide the actual URL in href using htaccess.
i.e when a user hover over the anchor tag, the browser displays http://example.com/index.php?id=12345 at the bottom. All I want the browser to display is http://example.com/index/12345 without changing it manually on all my pages.
Thanks for the help !
Why don't you change the link to the following?
Click here
As you can change the .htaccess I expect that you own or adminstrate this domain. So it should be possible.
If the links are generated by PHP code, then I suggest you to implement and use a translation function like:
function beautify($ugly) {
// your logic comes here
return $nice; // ;)
}
... and wrap it around the existing code that currently outputs the urls. This would have two advantages:
It's easy and more failsafe to migrate to the new url scheme
From now on you have control over all url related code using a single function
I agree, htaccess can't help you. I guess you'll have to change them manually.
I wish I could be of more help
No. htaccess is for processing input to the web server, not data sent back from the server.
If you use jQuery you could have it rewrite the href when the page loads using something like this.
$(function(){
$("a").each(function() {
this.href = 'some_new_url that you made based on the one in this.href';
});
});