- Posts: 33
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- How to chage the exta field value url link to mail function for k2 item extra feield?
How to chage the exta field value url link to mail function for k2 item extra feield?
- pamidipadudravid
-
Topic Author
- Offline
- Junior Member
mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
when we click it go for some other info.com , like that
but i need mail to means link MS Office mail for?
i like output like this : www.w3schools.com/html/tryit.asp?filename=tryhtml_mailto
what i do?
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
jproven.com/extensions/k2fields
It has option "pre-configured validated input fields for alpha, alphanum, number, real, integer, email, url".
Please Log in or Create an account to join the conversation.
- pamidipadudravid
-
Topic Author
- Offline
- Junior Member
- Posts: 33
Please Log in or Create an account to join the conversation.
- matthew turner
-
- Offline
- Senior Member
- Posts: 66
if you use the switch case break loop in your template over rides (as posted by Daniel Arnolf here - community.getk2.org/forum/topics/output-extra-fields ) you can assign a PHP variable for each of your extrafields individually by ID, you can use a simple textbox extrafield and a bit of html/PHP to add anything you want !!
<?php foreach ($this->item->extra_fields as $key=>$extraField): switch($extraField->id) { case 1: $EmailAddress = $extraField->value; break; case 2: $EmailSubject = $extraField->value; break; case 3: $EmailLinkText = $extraField->value; break; }endforeach;?>
All you would need to do after adding the code above (as referenced above), would be to echo the textbox variable inside the html email link :
<a href="mailto:<php echo $EmailAddress; ?>?Subject=Hello%20again">Send Mail</a>
or
<a href="mailto:<php echo $EmailAddress; ?>?Subject=<php echo $EmailSubject; ?>">Send Mail</a>
or even
<a href="mailto:<php echo $EmailAddress; ?>?Subject=<php echo $EmailSubject; ?>"><php echo $EmailLinkText; ?></a>
I use this method in my templates.... hope this helps you.
Please Log in or Create an account to join the conversation.
- pamidipadudravid
-
Topic Author
- Offline
- Junior Member
- Posts: 33
In above link i did what i want Mr.mat.., if i click on email extra field value, it will fire the mail to form...
Thanka a lot..... well done
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
Need to test.
Please Log in or Create an account to join the conversation.
- pamidipadudravid
-
Topic Author
- Offline
- Junior Member
- Posts: 33
plzzzzzzz
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
But i cannot ge it to work. Don´t know what wrong i am doing. So Mat, if you can please explain it step by step ?
I don´t want to echo extra field to some special place in Item, but to use extra field already among other extra fields. Just to be clickable.
Can´t get it to work both way. Checked other topic too.
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
case 1: $EmailAddress = $extraField->value;
to:
case 11:$Email = $extraField->value;
<a href="mailto:<php echo $Email; ?>?Subject=Hello%20again">Send Mail</a>
This is my field ID and field name, but no difference.
Please Log in or Create an account to join the conversation.
- matthew turner
-
- Offline
- Senior Member
- Posts: 66
My bad, I just noticed a typo with the code I posted above...sorry
should have been:
<a href="mailto:<?php echo $EmailAddress; ?>?Subject=Hello%20again">Send Mail</a>
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
Please Log in or Create an account to join the conversation.
- matthew turner
-
- Offline
- Senior Member
- Posts: 66
The code would need adding per template (category_item.php, latest_item.php etc) and can be used in the K2 content module template over rides as well....
On the Joomla protecting the email address from spammers, I'm looking into that, I think it may be Joomla only protecting the email address inside of main content area(or intro text)....
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
I need some option to turn ordinary Text Field into clickable email address, if it detects "@" in field.
Some simple solution. There are 5-6 files in admin/components/com_k2 that needs to be changed. But it is to much core changing for such small benefit.
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
<?php echo JHTML::_('Email.cloak', $this->user->email); ?>
Email.cloak hides email addresses.
Please Log in or Create an account to join the conversation.
- matthew turner
-
- Offline
- Senior Member
- Posts: 66
The above works nicely !
Just out of curiosity I tested the Extrafields plugin code that I posted for Jock (for the Gallery plugin) and that did the same wrap in javascript routine:
<?php echo JHTML::_('content.prepare', $EmailAddress ); ?>
Which again wraps it in Javascript - Joomla built in ?
Not sure at this moment how to add in/change the subject line...
Working on that next
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
Didn´t tried in deep last two, but Sobi is not near K2. And it would be shame to lose users just because of extra fields.
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
Some code snippets you can use in templates, some core (code) tweaks, etc...
I am aware that developers are not so eager to put new options, etc... K2 could slow down. But some central place where you can read documentation would be OK.
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
I don´t need it now, but paste it here for some future use.
All i got with my code was javascript code in address field, in mail client.
Please Log in or Create an account to join the conversation.
- matthew turner
-
- Offline
- Senior Member
- Posts: 66
Got it sorted in the last couple of minutes....Using the code you posted, with a bit of string replacement... ;)
<?php
$myhiddenemail = JHTML::_('Email.cloak', $EmailAddress); $JscriptSubject = "var suffix = ''";$EmailSubject = "var suffix = '?Subject=Hello%20again'";$myNEWhiddenemail = str_replace($JscriptSubject, $EmailSubject, $myhiddenemail);
?>
<?php echo JHTML::_('content.prepare', $myNEWhiddenemail ); ?>
This could be further modified if you echo another extrafield variable in place of the Hello%20again bit
I think this is part of how Joomla is coded, plugins, replacements etc to just work in the main content area...
K2 presents ways around nearly all of my issues of the standard Joomla.
Not sure how I got anything done before I started using K2 as I have found this forum and community to be a fantastic resource of information (including some from your posts BBC !) and similar minded people - I have learned so much about PHP,JSON,MySql etc from this forum and related searches to achieve my clients needs....
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- How to chage the exta field value url link to mail function for k2 item extra feield?