how to get value of URL Parameter of Weblink field

8 years 5 months ago #45263 by Pitpony
Hi

I am customizing a template...

How do you get a Weblink URL Paremeter eg [c:1gowcchv]www.example.com[/c:1gowcchv]

I have looked through FAQ'S with no success...

I have tried the obvious
[c:1gowcchv]$item->fields[website_url]->link[/c:1gowcchv] and
[c:1gowcchv]$item->fields[website_url]->url[/c:1gowcchv]
and get nothing...

If I use
[c:1gowcchv]<?php echo $item->fields[website_url]->display;?>[/c:1gowcchv]
I get the URL Paremeter nested in [c:1gowcchv]<a>[/c:1gowcchv] anchor tags...
e.g.
[c:1gowcchv]www.example.com[/c:1gowcchv]

All I want to return is the raw url address eg [c:1gowcchv]www.example.com[/c:1gowcchv].

Thanks

Please Log in or Create an account to join the conversation.

8 years 5 months ago #45302 by ggppdk
Hello

the raw field values is available elsewhere:
it is inside the array:
$item->fieldvalues[$field_id];

The following is described in our FAQ article:
Using the raw value of a field inside a template file

$field_id = 41; // CHANGE THIS !!
 
$fvals = $item->fieldvalues[$field_id];
 
if (!empty($fvals)) foreach ($fvals as $v) {
	if ( @unserialize($v)!== false || $v=== 'b:0;' ) $v = unserialize($v);
	echo "Link:". $v[link];
	echo "title:". $v[title];
	echo "hits:". $v[hits];
	// or use print_r($v) to see what is available !!!
}


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

8 years 5 months ago #45427 by Pitpony

Please Log in or Create an account to join the conversation.

8 years 5 months ago #45430 by ggppdk
Hello

please see a PM that i have sent you

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

11 months 2 weeks ago - 11 months 2 weeks ago #80664 by iamrobert
With newer php(7.4) need to wrap with '' eg
$v['link']
. Otherwise PHP Warning:




$field_id = 41; // CHANGE THIS !!
 
$fvals = $item->fieldvalues[$field_id];
 
if (!empty($fvals)) foreach ($fvals as $v) {
    if ( @unserialize($v)!== false || $v=== 'b:0;' ) $v = unserialize($v);
    echo "Link:". $v['link'];
    echo "title:". $v['title'];
    echo "hits:". $v['hits'];
    // or use print_r($v) to see what is available !!!
}


NEW URL:  Using the raw value of a field inside a template file

Please Log in or Create an account to join the conversation.

11 months 1 week ago #80732 by micker

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.
Save
Cookies user prefences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline