how to get value of URL Parameter of Weblink field

7 years 8 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.

7 years 8 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.

7 years 8 months ago #45427 by Pitpony

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

7 years 8 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.

2 months 3 days ago - 2 months 3 days 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.

1 month 3 weeks 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.