Skip to content

Instantly share code, notes, and snippets.

View wdebusschere's full-sized avatar
💭
Laravel / Kirby CMS

Wannes Debusschere wdebusschere

💭
Laravel / Kirby CMS
View GitHub Profile
@wdebusschere
wdebusschere / SymCMS - Getting data notes.mkd
Created March 29, 2019 09:02 — forked from DavidOliver/SymCMS - Getting data notes.mkd
Notes on getting data from within Symphony CMS

Written based on hacking away at a custom event which aimed to take its data solely from entry data and $_SESSION values, and not posted values (which I understand may have been open to DOM hacking and required "ugly" frontend hidden fields).

Things I think I've learned

Use Xpath in PHP when possible

I was traversing the XMLElement object generated by SymQL (or Entry object generated by EntryManager) with the object's methods and foreach to get values, which seems to require a lot of effort and code:

php
@wdebusschere
wdebusschere / Entrymanager-fetch.md
Last active March 30, 2019 21:45
Entrymanager fetch
//  fetch($entry_id=NULL, $section_id=NULL, $limit=NULL, $start=NULL, $where=NULL, $joins=NULL, $group=false, $buildentries=true, $element_names=null){
		  	$em = new EntryManager();

		    $entries = $em->fetch(null, 83, 10, 0, false, false, false, true, array ('title'));

		  //  	echo "<h2>Products</h2><pre>";print_r($entries);echo "</pre>";die;
        	$product_em = new EntryManager();
		$product_fields = array ('title');
		$products = $product_em->fetch(
@wdebusschere
wdebusschere / ds-custom-order-field.md
Last active April 1, 2019 15:43
Datasource Custom order field
public function execute(array &$param_pool = null)
	{

		$ordercolumn = $this->__processParametersInString('$url-order.1.column', $this->_env, false);

		switch ($ordercolumn) {
		case "0":
			$this->dsParamSORT = "name";
 break;