Menu
  • HOME
  • TAGS

How do I add to my URL from .htaccess based on cookie

.htaccess,modx

I found a solution last night that is working, not sure if it is the best answer, but it is working for me. Instead of using ([name]) for the cookie value I got rid of the ([ ]) so my htaccess looks like: RewriteCond %{HTTP_COOKIE} market=dc-metro [NC] RewriteRule ^fly-a-kite(.*)$ /dc-metro/fly-a-kite$1...

ModX friendly url has a bad format

friendly-url,modx

Sounds like you've forgotten to add <base href="[[++site_url]]" /> To your head. At least that is the first thing that comes to mind....

modx site is hacked how to solve

modx

You need to remove all malicious files, update your modx, update all plugins/extensions and change all passwords on site/db/ftp.

MODX custom .htaccess rewrite rule OR dynamic URLs

.htaccess,url-rewriting,modx

It looks like the order of your directives is wrong. Rewrite conditions only get applied to the immediately following rule, and you need your conditions to be applied to the index.php routing rule. So try: RewriteRule portfolio/tags/(.*)$ portfolio/tags?filter=$1 [L,N] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] ...

Make a button's active state show my search box

html,css,modx

Ok, first include jQuery library in the <head> section of your document e.g. Google CDN version <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> or download the compressed, production jQuery 1.11.0 and put it in your root folder then include it like this <script src="jquery-1.11.0.min.js"></script> then add below script just before the </body> tag <script> (function($)...

how to echo/print a nicely formatted array to the modx log?

php,modx

in print_r() function add 2nd argument TRUE for return output value, see below sample code $log = "<pre>"; $log .= print_r($formdata, true); $log .= "</pre>"; $this->modx->log(modX::LOG_LEVEL_ERROR, 'Form Data = ' . $log); ...

Trying to create multiple Modx resources from a form

php,modx,modx-revolution,modx-resources

print_r() on $allFormFields will very likely give you something like this: // dump of form values Array ( [pagetitle] => Array ( [0] => 'pagetitle1' [1] => 'pagetitle2' ), [longtitle] => Array ( [0] => 'longtitle1' [1] => 'longtitle2' ), ) That's why you're getting 'Array' when you try to...

Modx Evo - After copy from webserver to localhost manager login not possible anymore

php,modx,modx-evolution

To get rid of the mysql deprecated warning you have to use Evo 1.0.15+ and you should change $database_type = 'mysql'; to $database_type = 'mysqli'; in config.inc.php The 'only' thing that uses the old mysql_ functions is the installer then. The deprecated warnings are disabled in there for PHP 5.5....

How to add second level filtering to filtered results using PHP, JS

javascript,php,modx

I was able to solve second level filtering by inserting the following code to my javascript; $(".classes input[type='checkbox']").click(function(e) { var innerTextHTML = $(this).parent("div.selection").children('label').text(); var planWrap = $("div.plan."+innerTextHTML).parent(); if ($(this).is(':checked')){ planWrap.show(); }else{ planWrap.hide(); } }); One issue I had when I used this was nth row styling, which I was able...

Modx Redirector plugin limited resource list

modx,modx-revolution,modx-resources

I first went to the repository to commit a fix in but the file annoyingly isn't being tracked. https://github.com/splittingred/Redirector Fix: Open: /core/componenets/redirector/processors/mgr/resources/getlist.class.php Then add an initiator method: public function initialize() { $this->setDefaultProperties(array( 'start' => 0, 'limit' => 0, 'sort' => $this->defaultSortField, 'dir' => $this->defaultSortDirection, 'combo' => false, 'query' => '',...

How to group ModX Revolution GalleryAlbums by year

modx,modx-revolution

Currently the GalleryAlbums Snippet doesn't support sorting by year, even though there's a "year" field for the Album object: However, there's a couple ways to do this. 1. Write your own Snippet This would be the most performant option, but instructions for this might be out of scope here, so...

Sort articles by template variable

modx,modx-revolution

You can do this by using getResource package. Look at sorbyTV, sortdirTV, sortbyTVType parameters in manual: http://rtfm.modx.com/extras/revo/getresources#getResources-SelectionProperties...

How to get a list of all user groups in Modx Revolution

modx,modx-revolution

<?php $where = array(); $userGroups = $modx->getCollection('modUserGroup', $where); foreach ($userGroups as $userGroup) { print $userGroup->get('name'); } ...

Multiple Login forms on the one page

modx,modx-revolution

It's all because first snippet catch the call. Your second snippet can't react. You have to manipulate with submitVar or actionKey parameter. Just rtfm. You can get some information there also....

how to autopopulate email address with modx FormIt form from a url

html,forms,website,modx

You want to create a "Snippet", which is just a piece of php code. Call your snippet whatever and something like this should do: return (!empty($_GET['email']) ? $_GET['email'] : 'Enter e-mail'); Then in your chunk/template or wherever that code you pasted is, change the input value to: value="[[!NameOfYourSnippet]]". The bracers...

MODX FormIt overriding POST values

php,post,modx

So, everything was fine actually. I was looking at the Post Data via network tab, but the real posted data was completely fine.

ModX wont work without absolute paths

modx,modx-revolution,wayfinder

My templates were missing: <base href="[[++site_url]]" /> ...

Allocate a child resource to two different parents resources (?)

modx,modx-revolution,modx-evolution

Use getResources to search all your categories for the author name template variable. You don't need to assign multiple parents [though if you insisted on doing that you could use a resource alias to fake it] Your getResources would look something like: [[!getResources? &parents=`1,2,3` // your category ids &tvFilters=`author_name==[[+author_name]]` //pass...

preg_replace not working in snippet

php,modx,evo

You can not use MODX tags as is inside the snippets, you will need to use $modx->documentObject['variable-name'] So your code will be something like this: <?php $string1 = $modx->documentObject['longtitle']; $string = preg_replace('/\s+/', '', $string1); return $string; ?> ...

ModX Revo: Get Current Webuser or Manager session

session,user,counter,modx

I will try to solve it myself. Kind of solution: Write a plugin that track events and persist it in database or somewhere else: OnWebLogin and OnWebLogout. Then read the count of logged in users. Created a db table "modx_weblogin_session" (manually) userid, timestamp. Created a Plugin: if (isset($modx) && isset($user))...

migx TV (MODx REVO) - date format

date,date-format,modx,modx-revolution

http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29 - you need :strtotime modificator before :date - [[+mydate:strtotime:date=`%Y-%m-%d`]] ...

How to use two different outputs of one TV in MODX?

modx,modx-revolution

1 - use your tv - <a href="[[++site_url]][[*myFileTv]]">My File</a> 2 - use snippet like this - [[!getNameFromPath?&path=`[[*myFileTv]]`]] and code of this snippen is - <?php $path = $modx->getOption('path', $scriptProperties, ''); $fileName = basename($path); return $fileName; 3 - use another snippet - [[!getSizeFromPath?&path=`[[*myFileTv]]`]] which code is - <?php $path = $modx->getOption('path',...

get template variable value on each page modx revolution

modx,modx-revolution

It looks like you're using methods from MODX Evolution. Revolution is different so it would be a good idea to familiarise yourself with the documentation. I've provided some links below. To get a template variable value using the API is simple: $value = $modx->resource->getTVValue('tv-name'); $modx->resource always contains the object for...

Using New Relic with a modx website

modx,newrelic,modx-revolution

In general, the New Relic PHP agent lets you integrate most unsupported frameworks by using newrelic_name_transaction(). There's a separate guide explaining how to use this API call for reporting better transaction names.

MODX (Evo) Ditto and Carousel with multiple DIVs in which children resource IDs need to be loaded

html,modx,modx-templates,ditto

I solved it by placing a Ditto call within the carousel_articles chunk for each indivdual div (with different parents each matching my articles categories) and use the randomize parameter.

Modx throws an Call to a member function on a non-object in a plugin

php,modx,modx-revolution

I would remove the first "if" completely, you don't need to check if you're in manager or not since context doesn't make a difference there. You also don't need a switch to "web" context since that will be the default, you only need to change to "en" or any other...

How to filter ModX Revolution GalleryAlbums by tags / year

modx,modx-revolution

You can just create a new album (called 2014) and place the other albums inside (Album 1, Album 2, etc.) You can drag and drop albums into your 2014 folder or just right click it to create new subfolders....

html / css dropdown menu not dropping

html,css,modx,wayfinder

try this: nav ul li ul li{ display:none; } nav ul li:hover > ul li{ display:block; } http://jsfiddle.net/vpZ5J/4/...

ModX getResources template chunk HTML out of order?

modx,modx-revolution,getresource,modx-chunks

It was a weird issue with wrapping a block element (div) in an inline a tag. Changed div to span and it was ok.

Modx Revolution 2.2.8-pl simple database table query

sql,modx,modx-revolution

You can try something like: $results = $modx->query("SELECT * FROM some_table"); while ($r = $results->fetch(PDO::FETCH_ASSOC)) { print_r($r); exit; } It's documented quite well here: http://rtfm.modx.com/xpdo/2.x/class-reference/xpdo/xpdo.query Also, if you wave the wayfinder model loaded, you should be able to do without all the extra sql, take a peek at, getObject, getCollection:...

Group 'input option values' in template variable with 'listbox' type

modx,modx-revolution,modx-templates,modx-resources

That is easy ;) your listbox should contain a @CHUNK yourchunk In that chunk you can perform nearly everything, that genereates a list, like: <select name="something" id="something" > <option value="" selected disabled>choose</option> <optgroup label="Headline 01"> [[pdoResources? &parents=`0` &where=`{"template:=":40` &sortby=`{"value":"ASC"}` &limit=`40` &tpl=`pdoResourcesFormoption-something` &includeTVs=`some-tv`]] </optgroup> <optgroup label="Headline 02"> [[pdoResources?...

Wayfinder not working on new Evo install

modx,modx-evolution,wayfinder

My fault. I should have been copying the content of snippet.wayfinder.php not wayfinder.inc.php

MODx template variable image make downloadable

modx,modx-evolution

What is happening is that your TV output type is set to "image" - Modx will output an image tag in that situation and not just the path. You can change the output type to default so that only the path is output, then you can pass that to your...

Trouble with email sending in ModX Revolution via FormIt

email,phpmailer,modx,modx-revolution

This is a PHP bug that affects PHP 5.5.25 and 5.6.9 when run using mod_php with apache. There are a few workarounds until it's fixed in PHP. Downgrade PHP to 5.5.24 or 5.6.8 Switch to PHP-FPM instead of mod_php (which is a good idea anyway) Override the PHPMailer class and...

How to show MySQL errors from a failed Modx/xPDO query object?

mysql,modx,xpdo

Based on the examples in the xPDO Getting Started guide, $modx in this context appears to be a class extending PDO and the result resource object $myquery is likely a PDOStatement object. You can therefore set an exception error mode on $modx as you would with a normal PDO object....

Date TV format appears differently in getResources template chunk

modx,modx-revolution,modx-chunks,modx-getresources,modx-template-varaiables

I prefer to format the date during the output by an output filter [[+tv.NewsDate:strtotime:date=`%b %e, %Y`]] and set the output of the Date TV to standard. The output of the TV could be different from page to page with that.