Hyperlink in template file

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
raydona
Forum Newbie
Posts: 21
Joined: Sat Mar 21, 2009 9:17 am

Hyperlink in template file

Post by raydona »

Hi,
I wish to create about 200 web pages (html) files. Each file will have a hyperlink (<a href="http://......) to another site. Normally you would place the hyperlink in the html file. But if I had to change the address to a different site I do not fancy going through each and every file changing the hyperlink. Is there any way I can place the hyperlink in a CSS file so that if the
address changes I would have to just alter it once in the template CSS file and it would alter the address in all the html files. All help will be greatly appreciated.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Hyperlink in template file

Post by AbraCadaver »

Not sure about CSS. I use it frequently but I'm not a guru of all that it can do. What I can tell you is this is easy as pie with PHP.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: Hyperlink in template file

Post by daedalus__ »

well, the short answer is no.

and so is the long answer.

css is only for styling html like languages
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Hyperlink in template file

Post by AbraCadaver »

daedalus__ wrote:well, the short answer is no.

and so is the long answer.

css is only for styling html like languages
That was my gut feel. I know that you can specify the url of background images etc. in CSS, but wasn't sure if the same could be done for the href of a link. I thought no, but still someone could pop-up with an awesome example of how to do it.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
raydona
Forum Newbie
Posts: 21
Joined: Sat Mar 21, 2009 9:17 am

Re: Hyperlink in template file

Post by raydona »

Hi,
Many thanks for the replies. The only bit of php I know is connecting to a database. Would it be possible to give me the actual code or point me in the right direction as to what I should actually do.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Hyperlink in template file

Post by AbraCadaver »

Simple example.

Code: Select all

// example of your files (probably needs .php extension)
<?php include('config.php'); ?>
<a href="<?php echo $url; ?>">Link Text</a>

Code: Select all

// config.php
<?php
$url = 'http://www.example.com';
?>
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: Hyperlink in template file

Post by daedalus__ »

hey you aren't going to believe this but using the :before or :after pseudo-selectors and the content: attribute he could place the links in his css file. :roll: i haven't checked up on browser support though cause i was reading the spec.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Hyperlink in template file

Post by AbraCadaver »

daedalus__ wrote:hey you aren't going to believe this but using the :before or :after pseudo-selectors and the content: attribute he could place the links in his css file. :roll: i haven't checked up on browser support though cause i was reading the spec.
That's cool. If you have time, post an example.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: Hyperlink in template file

Post by daedalus__ »

Code: Select all

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
    <title>Conforming XHTML 1.1 Template</title>
    <style type="text/css">p.note:before { content: "Note: " }</style>
</head>
<body>
    <h1>Example of Generated Content using CSS</h1>
    <p class="note">I don't really think it should be called generated content.</p>
</body>
</html>
 
kracey
Forum Newbie
Posts: 2
Joined: Thu Jun 10, 2010 2:32 am

Re: Hyperlink in template file

Post by kracey »

Is it possible to create hyperlink from a web site to a specific section within a PDF document? For instance: I have a 125 page document, with 15 sections. I would like to create a hyperlink from a web page directly to section 9 within the PDF. When the PDF opens, I would have the entire PDF there to view, but it would open to section 9 automatically? Is this possible?
_____________________
affiliateelite ~ affiliateelite.com ~ adgooroo ~ adgooroo.com
Post Reply