Search

Yep, once 2.0.8 is out I will test with the updated Gateway class. If all is good, I’ll revert my curl implementation back to use Gatetway. I’ll check to see if auth-token works at the same time, since this would be more favourable.

Sweet! Passing auth-token to a frontend page does indeed log the user in. Thanks Rowan :-)

The only downside to this is that the user will need to enable the “remote login” option in their Author account. Not a massive problem, but it’s an extra hurdle.

I’ll wait to see if the updated Gateway class fixes this when 2.0.8 arrives. If it does, I’ll use it. If not, I’ll resort to auth-token. Either way, I’ll get rid of the single curl implementation in favour of re-using Symphony functions.

Sounds fair :)

Nick, by the way, I love this extension! So very cool! I’m using it in our church bookstore website where I’m pulling in the book’s cover via ISBN number from OpenLibrary’s API.

A temporary fix I’d like to mention:

When I migrated my site to a test server, the panels I had added totally broke the CMS, and there was no way to remove the panels, shut off the extension (without killing symphony), or edit the content in sections with panels.

Turns out safe_mode was on, but just for the sake of robust code:

change line 70~
if (ini_get('open_basedir') == '' || ini_get('safe_mode' == 'Off'))
{
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt( $ch, CURLOPT_COOKIE, $cookie);
    $result = curl_exec($ch);
    curl_close($ch);
} else {
//Add error message here
}

HTML Panel field updated to version 1.2 on 25th of August 2010

HTML Panel fields can now store a single string value (like a Text Input field or Select Box field). This means something like this is now possible without having to write any PHP.

Colour Picker field

Pass the field value in the URL to your HTML Panel page:

{$root}/my-html-panel/?value={entry/my-field-name/text()}

You can then build a form element in XSLT:

<input type="text" name="fields[my-field-name]" value="{$url-value}" />

To solve problems with:

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

Like described by @devoidfury in a post above (Comment #25):

if (ini_get('open_basedir') == '' || (ini_get('safe_mode') == 'Off'))
{
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt( $ch, CURLOPT_COOKIE, $cookie);
  $result = curl_exec($ch);
  curl_close($ch);
} else {
  $opts = array('http' => array('header'=> 'Cookie: ' . $cookie."\r\n"));
  $context = stream_context_create($opts);
  $result = file_get_contents($url, false, $context);
}

Nick this is a wanderful extension… Thanks!!

HTML Panel field updated to version 1.3 on 5th of February 2011

@nick

When left empty the URL expression at field creation in section, the sections’ entries are messed up. See hpf1.jpg.

  • ovals = Publish Tabs
  • rectangle = HTML Panel Field
  • lower right = Duplicate Entry (Save as New) ?? :)

On inserting anything in the URL expression field, it works as expected.

Attachments:
hpf1.jpg

Looks like this breaks JavaScript, or some bum HTML is inserted into the panel. I’ll investigate, thanks.

I found the usage of “$this->_engine” several times in “field.html_panel.php” and in “field.publish_tabs.php”. Shouldn’t it be replaced with “Symphony::Engine()” instead?

Nick, I had a hard time trying to get this to work. In the end I found the problem: cURL won't do SSL if it can't validate certificates, so you can't use the HTML Panel Field if your site uses SSL exclusively. I solved this the "dirty" way by adding the following in line 87 of field.html_panel.php:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

Since any "proper" solution would over-complicate things (see http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/), I suggest to add this solution.

I just noticed that the above hack is only necessary if you are using a self-signed certificate (which you shouldn't do on live websites, of course). So I am not sure if it's good to add my hack or not.

Thanks for working through this Michael. I reckon adding the CURLOPT_SSL_VERIFYPEER to the code would be sufficient for most uses of this extension, so I'll add it in the next version.

Yes, it would work even work with self-signed certificates, which is definitely good for development.

I wonder if we can imagine any security implications if this validation is removed. I guess that if the domain you are using to load content can not be trusted anymore because it has been hacked in the DNS (and is using a fake certificate), you will be lost anyway. What do you think?

So if you don't see any risk, I am glad if you add this cURL setting.

Nick, I am just playing around with the HTML Panel and a list of checkboxes. Do you see any chance to save checkbox values in the HTML Panel field or is saving indeed restricted to a single string?

[EDIT]: I can already save the last checked item. :-)

As far as I see, one might modify the field class to allow arrays as values. It might more or less be a matter of imploding/exploding $data (and using a longer database field for the field's value). (Yes, this would not allow text values containing commas, but it might be great to store arrays of IDs etc.)

Now the question is: Would you like to implement this at all?

Nick, maybe I should try and find a different solution to my challenge. I would need the ability to filter data sources as well... This might be too much for the HTML Panel Field, so maybe I should build a dedicated custom field.

Nevertheless I would like to know what you think.

I think I agree — a custom field would be better if you need anything more complex. I was hesitant even to add basic value storage to HTML Panel because its original purpose was not to build fields, so I don't want it to get any more complex.

Is there another extension that comes close? If a list of checkboxes is what you need, then the Multiselect to Checkboxes might be a useful starting point. And if you need the checkboxes to be dynamic, then perhaps start with the XML Select Box.

Thanks Nick. My goal is to have a hierarchical list of items which are organized in different sections (using the Subsection Manager), with checkboxes on the lowest list level only . I have a working datasource and I can display the list on the frontend, that's why I tried to use the HTML Panel field. I will try and create a custom field now.

[EDIT]: It would be cool if I was able to build the field's publish panel using XSLT, like Huib did with backend pages in his Email Templates extension.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details