Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

Avoid repeating a domain name

ian

Joined
Jan 10, 2008
Posts
4,053
Reaction score
753
The holding page I'm working on currently requires me to enter the domain name a few times in various bits of the html code (and contact form). Is there a way in which I can add the domain name once, and then reference it with some kind of basis code everywhere else, so it is quicker when I set up a new page.

Something like thisismydomain.co.uk, and everywhere else NAME={domain-name}. You get the jist (hopefully!).
 
Are you creating the html page with php (asp) or is it a static html page?
 
If you're using a static html page you could include jquery and then wrap something around each occurrence eg <span class="domainName"></span> then just have a piece of code that runs on page load $(".domainName").text("whateverdomainyouwant"); That would change all occurrences
 
If you're creating the page with php you only need to put the domain name in a variable then <? echo $domainName; ?> wherever you want it.
 
Rob's way is ideal. Even if your working in html you can essentially just change the extension to .php and it will work once on server. PHP var defo the way to go.
 
Thanks guys. It is a static page built from HTML, with a php contact form and a few jquery type files for opening stuff on the page. It was a bought option, I didn't create, so I'm struggling a little with the best method...or whether this is a seo no no to mask/hide the name too much?
 

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Premium Members

Latest Comments

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom