Best practice forum (Archived)

Add HTML link to .php file

 
Bodo Hoenen
Add HTML link to .php file
by Bodo Hoenen - Friday, 15 July 2011, 12:27 PM
 

Hi there

I am hoping this can be covered in this forum,

My users want some additional information displayed to them once they have requested enrolment to a course, before they click yes to enrol, they want some additional information displayed which includes a hyperlink to an external website. I can add this additional information to the PHP file and it displays correctly, but as soon as I try add a hyperlink it will not show anything.

Here is the code without the hyper link:

$string['application'] = '<p>This is a Leeds Met accredited course, the process to complete the enrolment will be as follows:</p>

<li>Register your details at Leeds met by clicking by going to the following URL: http://applyonline.leedsmet.ac.uk  </li>

<li>Leeds Met will then assess your eligibility and help you register for the course </li>

<li>Once registered you will receive a student welcome pack, a student ID number, and instructions on how to obtain a  Student Card, which will give you significant discounts on a wide range of goods and services.  </li>

<li>Leeds Met will introduce you to your allocated tutor, and assist you in getting started</li>

</ul>

<p>It is at this stage your enrolment will be made active and you will be able to access this course</p>';

 

I would like to include a Hyperlink on the 2nd line but no matter what I try it will not work.

Any suggestions?

Regards

Bodo

Simon Coggins
Re: Add HTML link to .php file
by Simon Coggins - Tuesday, 19 July 2011, 3:42 AM
Group Totara

If you are including the hyperlink with code like this:

<a href="http//www.example.com/">Example</a>

Then you will need to escape the double quotes with a slash (e.g. type \" instead of " ). Otherwise moodle's language parser will break.

If you're still having trouble, try setting the debug level to maximum (via Site Admin > server > debugging > set to developer and check display to screen) then view the page with the string and see if you get any errors.

Simon

Bodo Hoenen
Re: Add HTML link to .php file
by Bodo Hoenen - Tuesday, 19 July 2011, 6:55 AM
 

Thank you

This has worked,

for reference, for anyone looking at this post in future the new working code looks like this:

<li>Register your details by clicking on the following link:<a href=\"http://www.example.com/\" target=\"_blank\" > <U>click here</U></a> or by entering the following URL into a browser: http://www.example.com/  </li>


Kind regards

Bodo