Maillink - An attempt to hide my email address in the source code

· 2 min ·

I have set up a link on the start page so that people who are interested can also contact me by email. But I wanted to avoid having my email address in plain text in the source code.

So it was clear that an extension was needed. And one in which I can also display icons. Which is somehow logical, since it makes no sense to hide the address in the source code for mailto: links and then display it in plain text in the frontend.

After my first excursion[1] into extension development for Yellow, it was much easier for me to get started this time. It was so much easier that I decided to add a few language default settings.

// Handle initialisation
public function onLoad($yellow) {
    $this->yellow = $yellow;
    $this->yellow->system->setDefault("MaillinkAddress", "Insert your desired email address or remove this string");
        "Language: it",
        "MaillinkText: Lasciatemi un messaggio",
        "Language: de",
        "MaillinkText: Schreib mir ein paar Zeilen",
        "Language: en",
        "MaillinkText: Drop me a line",
        "Language: sv",
        "MaillinkText: Skriv till mig",
        "Language: fr",
        "MaillinkText: Contactez-moi",

The main challenge was that the texts for MaillinkTextweren't written to the yellow-language.ini file by the extension code. I copied the code from several extensions and adapted it to my values. Always in vain...

I then reached out to the community[2], and the initial suggestion for solving the problem was the key: I had previously written MailLinkText and MailAdress and had not kept to the name of the extension (Maillink). After I had changed this, it worked.

Oh boy, that was a lot of gibberish again. Anyway, here's the extension: yellow-maillink. And if you have any questions, you now know where to find my email address :wink:.

Reply via e-mail

Back to top