This topic is locked
[SOLVED]

Graphic button for telephone link from database

7/8/2021 7:56:39 AM
PHPRunner Tips and Tricks
A
Andreas G. author

Graphic button for telephone link from database
(List or View)

img alt

Here you can create a button for free

https://www.clickminded.com/button-generator/

Next:

Field property telephone number:
List or View:
Custom !!!
$value = '<a href="tel:'.$value.'"> Call us! </a>';

Add text as rich text on the page
Import the desired graphic there
Switch off rich text again and copy the visible code into the clipboard or Notepad ++ or another editor.

Replace> Call us! </a> ';
from
$value = '<a href="tel:'.$value.'"> Call us! </a>';
with the code

Before:

$value = '<a href="tel:'.$value.'">Call us!</a>';

After that:

$value = '<a href="tel:'.$value.'"<p><img src="data:;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAAeCAYAAAC7Q5mxAAAFg0lEQVRoge2aa2xTZRjH/+fa9py26y6029qujKkV2A0GcgsEFIIRCDEGRQPRL24mmvhBE6Ni+KDyEcV4CRgxGhNjSICImAgbxrEAiSLi2IWNjV2yHjp6X9tzenra+mFbWQOytsOV4n7fzvs+57z//PM+z/u+5xwikUhgEq8/XHa6tbOp9ULvbo8vZFaUuApzgNOw/vJSQ/fSauvPWzfW7lermeBkHzFp4MW/B7d+9GXLD/S8Uk5jNILR6UDSdM5E30/E5AiiY0GIo06oQr4bTbvXvdxQa/sJmDCw9ULvri++P/dN4aJqkjUYcq33vibi8SBwtTPy3mubNz76UGkbEQxJhlff+X6AW1hTMGdeeog3RxHt73F/vu+F+VTdiu1v9/qxmbdYcq0rb2B4HiGfnyvmqT7KXr/lQ7nQZKU5Lte68osE4Oi9biaHHZ5qRqfLtZy8gy0ogOD0P0KKUlRPsWyu9eQdlFoNUYrqyVwLyXfyeqNHkcDO5UYsKuPA0gSGPRF8csYxqxpmZODulUY02Mbr56FWAZ1C+J6ISpeVlXosn69DRInj2qiEG355VscHZmAgSxGoNvOQonGoGRLLbNpZN9CoZwAA5/sCOP6Xe1bHniRrA6vNPFQ0ibO9ftRaeFSbebA0AVm5dbZ+f7sNfjGGUx1ebKsrg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9uHthz6rvVgmNWaNfOMYPR60BpNjuXeHyiiCNnngzjqBKeIjndff2pzhbnoCjDl3xgAkGVF03y2q7Gn37mq46qw3j8mZveS7AGD07B+a3nhlSc3LP50xZLKozRNJb8d/AOme0OHpR99LwAAAABJRU5ErkJggg=="></p></a>';

Finished

I don't know if it's a clean code ...

A solution with a custom button would be nicer, but as a beginner I can't do that.

Translated with Google
greetings from Germany

admin 7/8/2021

It is a nice code, thank you for sharing!

Personally I would use an file-based image instead of inline base64 image data. It makes your code cleaner and also you can replace your image file at any time without rebuulding the project.

A
Andreas G. author 7/8/2021

I tried it but then the picture is not found ???
But the picture is available on the server ...

admin 7/8/2021

It is the matter of specifying correct URL of the image file. Try the full URL like https://mywebsite.com/images/callus.png

A
Andreas G. author 7/8/2021

This is how it works now
Example:

$value = '<a href="tel:'.$value.'"<p><img src="/images/telefon64.png"></p></a>';

img alt