-
Posts
68 -
Joined
-
Last visited
Everything posted by MadHatter
-
Yes, that would make more sense. It would still be nice to know where to put extended classes though. EDIT: Just tried the unique() function, it works but doesn't let me sort the results in the way I'd like. I need to do an initial search to get a PageArray and then add the results of the second PageArray to the first, ignoring duplicates. unique() seemed to be returning the results in the same order each time, which is not desirable. I've extended the PageArray like so: class UniquePageArray extends PageArray { public function appendUnique($pageArray){ foreach($pageArray as $page){ if(!$this->has($page)){ $this->append($page); } } } } This has the advantage of having the appended Pages appear at the end of the PageArray.
-
Hi, I've thrown together a quick class that extends PageArray to allow me to append unique pages to a PageArray (so if the appended PageArray contains pages which already in the PageArray then they are ignored). I've put the class inside _init.php but I just want to check what the best place to set this class would be as I'm not sure this is the right place to save it. Thanks, MadHatter
-
$config->urls->root and $config->httpHost Empty
MadHatter replied to MadHatter's topic in API & Templates
$_SERVER['HTTP_HOST'] is returning the web address I'm currently using. -
$config->urls->root and $config->httpHost Empty
MadHatter replied to MadHatter's topic in API & Templates
The domain is listed in the $config->httpHosts array. Does the domain need to be speicified for it to be callable via $config->urls? I was under the impression that it was pulled automagically from $_SERVER environment variables. -
$config->urls->root and $config->httpHost Empty
MadHatter replied to MadHatter's topic in API & Templates
I'm just trying to echo it out in a template file. I'm just trying to get ProcessWire to print out the web address of the site (e.g. "http://www.example.com"). -
Hi, I've tried printing the domain url but can't get ProcessWire to return anything. I can get it to work if I manually define the url in config.php but shouldn't this be detected automatically?
-
I've created a new tab that I'm planning to use to download a list of all the users currently signed up to my site. What I'd like to do is set it up so that when the tab is clicked a file is downloaded, there should be no extra page shown with a download link. My current issue is that when the file is output as an attachment the admin theme is still being rendered and appended to my file. This causes Microsoft Excel to fail loading the spreadsheet. If you view the Excel file in a text editor you can see the HTML for the admin page has been added after the spreadsheet contents. Is there a way to stop the admin theme form rendering from within an execute() fuction in a Process module? So far my solution has been to end the execute() function with die(), though I feel that this is not the ideal solution. I was hoping there was a command I could call to stop the admin theme from rendering (such as with CakePHP's $this->autoRender = false) so that the functionality I was looking for could be acheived. Has anyone else tried what I have been attempting?
-
Hi, I'm receiving the following error after upgrading ProcessWire: Error: Exception: Method Page::viewable does not exist or is not callable in this context (in /processwire/wire25/core/Wire.php line 349) #0 /processwire/wire25/modules/Process/ProcessPageView.module(407): Wire->__call('viewable', Array) #1 /processwire/wire25/modules/Process/ProcessPageView.module(407): Page->viewable() #2 /processwire/wire25/modules/Process/ProcessPageView.module(143): ProcessPageView->checkAccess(Object(Page)) #3 [internal function]: ProcessPageView->___execute(true) #4 /processwire/wire25/core/Wire.php(389): call_user_func_array(Array, Array) #5 /processwire/wire25/core/Wire.php(344): Wire->runHooks('execute', Array) #6 /home/edinudio/public_html/index.php(214): Wire->__call('execute', Array) #7 /home/edinudio/public_html/index.php(214): ProcessPageView->execute(true) #8 {main} This error message was shown because you are logged in as a Superuser. Error has been logged. Administrator has been notified. I uploaded the wire dir into a new directory and changed $wireDir in index.php, however this error appears ont he site now. The new wire dir is accessed via a symbolic link, which is also being used on another ~10 sites. As a test I copied the sybolically linked wire dir into a new directory in the site's folder and pointed to that and it seems to work also, so I'm not sure what exactly is happening. Has anyone else had issues with either the upgrade process or symbolically linking the wire directory or experiencing diffierent behaviour between similar sites? I've been pulling my hair out over this for a few weeks now. Thanks. EDIT: I've created another test symlink and used a different name (this one is called "wiresym", the original is called "wire") and it seems to have fixed the problem. Is there some cracy caching thing going on? I tried deleting the broken symlink and renaming the working one to "wire" but then it started playing up on me again.
-
Password Banned List has been updated, you can now add your own banned.list file to site/assets/PasswordBannedList/ dirctory. Each password should be written on a separate line, and this won't get overwritten when the module is updated.
-
Loading files from module directory
MadHatter replied to MadHatter's topic in Module/Plugin Development
Thanks! -
How do I get the directory of my module? I've checked my code and the cwd is the templates directory. One of my modules refers to the site modules but of course you can install into the core as well. I want to be able to load a file from within the module to process but I can't seem to figure out how to get the directory my module is installed into.
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
MadHatter replied to David Karich's topic in Modules/Plugins
I had this problem before I realised that the scripts and CSS files are relative to the templates directory. Check you're not using link relative to the site root. -
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
MadHatter replied to David Karich's topic in Modules/Plugins
As would I. Currently I have a foreach pushing the list into an array and using that but if I could use the FilenameArray it would simplify my code a great deal. $min_js = array(); foreach($config->scripts as $script){ $min_js[] = $script; } if(count($min_js)) echo '<script src="'.AIOM::JS($min_js).'"></script>'; I'm not sure about my foreach since it could be run on an empty $config->scripts but I don't know how best to check a FilenameArray is not empty, count() returns 1 when it's empty usually. -
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
MadHatter replied to David Karich's topic in Modules/Plugins
Hello, is there any way for AIOM to accept a FilenameArray object for minifying or do I need to convert the object to an array manually first? -
Running Multiple sites with one core in WHM/cPanel
MadHatter replied to MadHatter's topic in General Support
Thanks adrian, it looks like I'm going to use symlinks to connect to the core. -
Excellent. I updated the version number in the module too, hopefully this will be reflected on the modules page once it's been approved.
-
Hi Ryan, Thanks for the information, I'll update the module in GitHub when I get the chance (switching computers at work today). Do I need to do anything special to update the Module listing (such as version number)?
-
Hello, I'm trying to figure out if it's possible to install one ProcessWire core for multiple sites under WHM/cPanel. When a new domain is set up then a new user is created on the server along with a home directory containing a public_html directory for serving the new site. I've come to the understanding that the core needs to be web accessible and the only way I can see to do this is to have one core per ProcessWire installation. The other option is to use symlinks but I'm not sure that's possible through cPanel, and we seem to not have shell access on our server (though I'm sure we could ask if needed). This, however, makes setting up new sites a bit of a pain. Another option would be to produce a PHP file to create the symlink for a one-time execution, then delete the file. I'm still not keen on this options but it may be the best solution. So my question, I suppose, is are there any easier options to run several sites from one core without giving them all the same root directory?
-
Creating module to handle password validation
MadHatter replied to MadHatter's topic in Module/Plugin Development
Hello, I've made this into a module and posted it in the Modules section (here). -
I've made a module for checking a password against a banned list. The list comes from the 10,000 most common password list and when input will produce an error informing the user that their password is in the list and a more secure password should be used. The module was based on a question I asked in the development section (over here). The banned list is found in the module as banned.list so passwords can be added/removed as required. The module should be in the Modules section once it has been approved. PasswordBannedList.zip
-
How does the upgrade alter the index.php and the .htaccess file on a multisite setup? Will the installer need to be run on each site? I was under the impression that upgrading ProcessWire was as simple as just replacing the wire folder and you're done.
-
Thanks, I think we'll stick with installing it to our base site which we copy for new sites. Out of curiosity, what gets overwritten when ProcessWire is upgraded? The entire Pro Cache module or just the cache and htaccess rules?
-
Creating module to handle password validation
MadHatter replied to MadHatter's topic in Module/Plugin Development
Cool. I'll give this a go and see how I get on. I'd like to move this into a module at some point to allow easybuse by others but I'll work on getting it working before I think about that part 9f my plan. -
HI, I'm looking to implement some rules for password creation and I imagine I'll need to create a module for this. One thing I'd like to do is block the 10,000 most common passwords (From this article) by checking the entered password against the file containing the list. Are there any methods of hooking into the password reset page (or potentially any password entry pages I need to create) to validate against the list or will this require more than a module to accomplish? EDIT: Title is misleading, it should have been password validation rather than password entry. Apologies.
-
Hi, can Pro Cache be installed to the core rather than the site modules directory? I'm hoping to run multiple sites from one core and would like to install Pro Cache once and then forget about it. So far I've found nothing to say it's not possible but I feel the .htaccess edits may be the reason I haven't seen a definite yes to my question.