×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Custom Fields URL Type

Custom Fields URL Type 7 years 11 months ago #35364

  • Peter Ashford
  • Peter Ashford's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 217
  • Thank you received: 33
Hello - I have URL custom field setup for Hotspots. Would like to change the a href tag to show specific text rather than the actual URL. For the life of me I cannot find it in the hotspot default file. Guess it is linking somewhere else. Can you please tell me where?

thanks Pete

Custom Fields URL Type 7 years 11 months ago #35377

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hardcoded text? Or dynamic text?

Custom Fields URL Type 7 years 11 months ago #35378

  • Peter Ashford
  • Peter Ashford's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 217
  • Thank you received: 33
Hardcoded. Want the same text for each hotspot. cheers Pete

Custom Fields URL Type 7 years 11 months ago #35390

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Pete,
I just had a look at the code. in the render function of the fields we do this:
JPATH_SITE . '/templates/' . CompojoomTemplateHelper::getFrontendTemplate() . '/html/' . $component . '/fields/customfields'
Basically we are looking for custom fields definitions in your site tempalte in the html/com_hotspots/fields/customfields folder
if you place the libraries\compojoom\form\customfields\url.php file in there and you do modifications to it. You should get the desired outpout.

The render function looks like this:
	/**
	 * There is no need to translate the value for text fields
	 *
	 * @param   object  $data              - the object with the field value
	 * @param   string  $valueToTranslate  - the value for the field
	 *
	 * @return string
	 */
	public function render($data, $valueToTranslate)
	{
		return '<a href="' . $valueToTranslate . '" target="_blank" ref="nofollow">' . $valueToTranslate . '</a>';
	}

just change $valueToTranslate to something else :)

Regards,
Daniel
The following user(s) said Thank You: Peter Ashford

Custom Fields URL Type 7 years 11 months ago #35393

  • Peter Ashford
  • Peter Ashford's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 217
  • Thank you received: 33
Nice one, thank you Daniel. I'll try it out later. thanks Pete

Custom Fields URL Type 7 years 11 months ago #35395

  • Peter Ashford
  • Peter Ashford's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 217
  • Thank you received: 33
Hi Daniel - I made the amendment your suggested and it does change the URL text, but only when on the main Hotspots page where it shows all hotspots. When I click on the hotspot and go into it's own hotspot page, it defaults back to not showing my amendment. Does the hotspot page use another file for this?? thanks Pete

Custom Fields URL Type 7 years 11 months ago #35400

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Sure? Cache maybe? This code should be used everywhere.

Custom Fields URL Type 7 years 11 months ago #35401

  • Peter Ashford
  • Peter Ashford's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 217
  • Thank you received: 33
I thought it was cache too. However, have cleared and completely turned off the site caching and still get the same result. Cleared browser too.

Test page examples here ...

Main page
www.cyclingtouring.org/local-cycle-touring-leaders

Hotspot page
https://www.cyclingtouring.org/local-cycle-touring-leaders
  • Page:
  • 1
Time to create page: 0.121 seconds