Skip to main content
Participant
December 5, 2009
Answered

Creating the correct link for an include?

  • December 5, 2009
  • 1 reply
  • 750 views

Hi folks,

I've been learning about DWCS4 and am currently adapting my site (www.customscollector.com) to update and modernise it. What's on the site is quite old.

My question relates to includes and generating the correct link.

I have divided my page into appropriate <div>'s - wholepage, header, index, main content, footer and translate (within footer).

The purpose to doing this is multiple:

1. Cleaner coding (learning)

2. Standards compliant

3. Easier updating

At present, I offer a translation link at the bottom of each page, originally hard coded into each page way back when, along the lines of:

<a href="http://fets3.freetranslation.com/?sequence=core&url=www.customscollector.com/customs/template.htm&language=English/French" ><img border="0" src="../images/flags/france.gif" width="25" height="15" /></a>

Wherein, the above would resolve to do the following: (Clicking on the image of a French flag, the link would resolve to the translation engine for translating the template page from English to French - or German, or Spanish, etc., - you get the idea)

Having framed where I am coming from, my question is this:

Using a <div> for translation options, how do I make sure that the <div> include generates the correct link for the page created?

As an interesting aside, visiting the freetranslation site while composing this question led to an interesting discovery: freetranslation offer a simple include that appears to handle the exact issue that I am asking (and no, I am not affiliated in any way with there site - I just find it useful for what I am doing):

<script src="http://www.freetranslation.com/page-translator/?sourcelang=en"></script>

Any answer to this question would be gratefully appreciated, as I am sure there will be other issues that may come up in the not too distant future....

Thanks for your time and input, I do appreciate it.

Sincerely,

John de Belle

This topic has been closed for replies.
Correct answer bregent

>Using a <div> for translation options,

>how do I make sure that the <div> include

>generates the correct link for the page created?

Not sure what you mean regarding using a <div> for translation options.  A div is just a container. As for making sure the correct link is created, just add the script they provided to your template so the translater appears on each child page.  If that's not what you are asking, you'll need to explain better.

1 reply

bregentCorrect answer
Participating Frequently
December 5, 2009

>Using a <div> for translation options,

>how do I make sure that the <div> include

>generates the correct link for the page created?

Not sure what you mean regarding using a <div> for translation options.  A div is just a container. As for making sure the correct link is created, just add the script they provided to your template so the translater appears on each child page.  If that's not what you are asking, you'll need to explain better.

Participant
December 5, 2009

Sorry for the confusion.

Yes, I am using the <div> to define certain parts of the overall page.

You are correct, the script works perfectly and is what I will be using.

What I was thinking is, because I was creating an include, how do I get the include to correctly reference the page it is included in?

To explain, I create an include (say, translate.inc.php) to appear at the bottom of each page. So, for example, widgets.php has translate.inc.php at the bottom of the page.

Setting aside the script option for one minute (which is the perfect solution), how would I ensure that the include file referenced the correct page: ie., widgets.php and not translate.inc.php if I had to hard code part of the translation link request?

Would this require the use of Javascript, for example? Or is the use of externally generated scripts, as indicated, the solution?

Thanks again for your time.

Sincerley,

John de Belle

Participating Frequently
December 5, 2009

>how would I ensure that the include file referenced

>the correct page: ie., widgets.php and not translate.inc.php

>if I had to hard code part of the translation link request?

You do not need to worry about that. Server side includes are assembled into their parent pages at the server and sent to the client. As far as the client is concerned, there is only one page - widegets.php. The client ( and scripts within the client) don't know anything about translate.inc.php.