Jump to content

MadHatter

Members
  • Posts

    68
  • Joined

  • Last visited

Everything posted by MadHatter

  1. Oh yeah, good point. I'll probably do that then.
  2. Can images be used as configuration options in modules? I'm trying to develop a module and I'd like the option to set an image to use, but so far I haven't had any success. Currently the images I upload to test are declared invalid (the debugger doesn't show a width so it throws an exception). SVG files work, but nothing is stored in the data value of the config field (returns an empty array). I've set the upload directory to a new directory inside assets and the images are uploaded, but not unlinked when image fails. Am I trying to do something that's not going to work? I feel like I'm close but can't seem to figure out what's missing. Thanks, MadHatter
  3. @netcarver I'm finding that the script is timing out on a large site I'm working on (there are ~1800 pages). I've tweaked the code to only find pages in which the found fields are in use and are not empty: ... // collect fields and cropsetting names $collection = array(); echo "<ul>"; foreach ($fields as $f) { if ($f->type != 'Fieldtype' . $oldFieldtype) { continue; } $collection[$f->name] = array(); echo "<li>{$f->type} : {$f->name}</li>"; $thumbSettings = preg_match_all('#(.*?),.*?\n#msi', trim($f->thumbSetting) . "\n", $matches, PREG_PATTERN_ORDER); if (!$thumbSettings) { continue; } $collection[$f->name] = $matches[1]; echo "<ul>"; foreach ($collection[$f->name] as $suffix) { echo "<li>{$suffix}</li>"; } echo "</ul>"; $field_names[] = $f->name; } echo "</ul>"; echo "<hr />"; $pages_visited = 0; $images_visited = 0; $variations_visited = 0; $variations_copied = 0; // now iterate over all pages and rename or copy the crop variations echo "<ul>"; $selector = implode("|", $field_names) . "!='',include=all"; $found_pages = $pages->find($selector); foreach ($found_pages as $p) { ...
  4. Does TextFormatterHannaCode need to be so large? The bundled version of Ace contains all 4 versions of the Javascript files, but in ProcessHannaCode.module I can only see the src-min version being called in. Removing these and the demo directory would reduce the size of the module by around 38MB. Are there licensing issues which require that these files must be present?
  5. Hi, We've just recently moved a ProcessWire site from our development server to its new location and seem to be running into an issue with uploading large files. After a while (we've timed it at 30 seconds) the upload resets to 0% and then starts again. We figured that it must be a php/apache issue so we added in a few extra settings in our .htaccess file <IfModule mod_php5.c> php_value max_execution_time 200 php_value max_input_time 200 php_value upload_max_filesize 300M php_value post_max_size 300M php_value memory_limit 512M </IfModule> Despite these changes (which we confirmed using phpinfo()) we still cannot seem to get the uploads to go past a certain point. What other issues could be causing this? I wondered if our /tmp directory needed to be bigger but as the files are only 10MB or so I'm doubtful that this would be the issue. Has anyone else encountered a similar issue?
  6. Thanks mr-fan, I'll give this a go, I was thinking that some sort of hook would be the safest options, but I wasn't sure where the best place to implement it would be. EDIT: Works perfectly, thanks!
  7. That seems like there may end up being issues with data going out of sync. A sensible solution would be to add an option to the template settings to hide pages of that type from counts and searches.
  8. Hi, I've been trying to return the number of children that a page has that are viewable but I'm just getting back the total number of pages. The pages aren't viewable because there is no related template file. $page->numChildren() does not work (both true and false returns the same value). The current method we've been using it to run a command in the _init.php file that checks for pages that use that template and set them to hidden. I'm concerned there will be performance penalties for this.
  9. It's just occurred to me that it would be nice to set the output format of images (when resizing etc). I've just had to upload a load of magazine covers that were sent to me as png files. Considering the magazine covers are fairly complex images then a jpeg would be a better format for these. My client will be handling the uploading once the site is live so I cannot control what format they upload the images as (without adding some rules to my fields). Being able to set the resized image format could potentially save on some bandwidth.
  10. Is anyone else using this module combination? I've been trying to get the PayPal payment method to work but I haven't been able to get a VERIFIED response yet. I've up-ended the code several times now, and tried as many ways as I can think of to get a result. PayPal seems to have absolutely no method of debugging INVALID responses so I have no idea where the script is going wrong. Has anyone else had a similar problem and what was the solution you finally came up with? I've been banging my head on a wall for 2 days now, I just want to get my script working and move on to other things.
  11. I've installed the ShoppingCart module into ProcessWire and have set up most of the shopping process. I've reached an issue though where when I select to update the cart item quantities or to remove an item from the cart then I am redirected back to the homepage of the site (which has nothing to do with the shopping pages). The same is true for the "Proceed and review your order" button at the end of the address and contact information step. I'm guessing the issue is something to do with the form action for each being "./" but I can't seem to find anywhere that this address can be updated (I would have assumed that the page should redirect to itself at the very least. It should be noted that I am currently working on a development version of the site on m y Windows 7 machine, the site is usually run on a Linux server and I have had issues it dot-slashes ("./") in include paths in PHP. This may or may not be related to the issue I am experiencing. EDIT: Figured it out, the base href was set in the head of the site pages, this caused issues with the relative links to pages.
  12. Does the Shopping Cart module support shipping costs per item? There appears to be a fixed price options but my client wants to have the shipping calculated per item (I have suggested several times to put the shipping cost on the item and promote it as "free shipping" but they seem to be uninterested in this). It there a method of calculating postage? EDIT: I figured it out, I needed to create a module to handle the shipping calculations.
  13. Cool, thanks for that. I'm sure I tried soemthing similar but got an error on the input field in the manager. I'll refer to this when I look over it again tonight.
  14. That's kind of what I want to do but it would still only allow me to output to one format. I'm trying to figure out how to extend the text field with other functions, like how images have url and height/width fucntions. How would I do that? Can I use the format function to return a new class?
  15. Hi, I've been trying to create a new field type that takes a Twitter username and formats the input value. I've managed to modify another module to perform the correct validation when the page is saved but I can't figure out how to extend the code so I can do other things. One example is to output a link to the Twitter page for the username. I was imagining somethign like this: $page->twitter->url Would output 'https://twitter.com/processwire' while doing $page->twitter Would output '@processwire'. I've extended the InputfieldText and FieldtypeText classes but so far I have not figured out how to modify the value that ends up in the templates for me to use. Could someone help shed some light on this for me please? I'm aware that this could easily be handles in the template files but I wanted to do this as a learning experience to understand how the fieldtypes and Inputfields work. Thanks, MadHatter
  16. That's what I thought. I ended up using: $objWriter = new PHPExcel_Writer_Excel2007($spreadsheet); header('Content-type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=iso-8859-1'); header('Content-disposition:attachment; filename="Orkney Business Directory Listings.xlsx"'); $objWriter->save('php://output'); die(); at the end of my render function. Thanks!
  17. Hi, I'm trying to set up a tab in my admin area that, when clicked, will return a spreadsheet of all of the pages of a certain type (The template type is hard coded as it is for a single site for a client). I'm using PHPExcel which can output to php://output but I cannot find a way of preventing the template for the admin page from being output also. Is there a way to do this is is there another, more desirable method of achieving what I have aimed to do? Thanks, MadHatter
  18. Hi, I have ProcessWire set up in a directory in my localhost, and when I check the Minified CSS the URLs for backgroun images are incorrect (it is ignoring the path to the proceswire root). Is there an option somewhere I can use to either stop AIOM modifying the paths or to prepend the paths with the correct path to ProcessWire? Thanks, MadHatter
  19. Hi guys, I've looked at both of thos posts but I still could not seem to get the original data out. Here are my functions so far: public function init() { $this->log = new FileLog(wire('config')->paths->logs,'changelog'); $this->addHookAfter('Pages::saveReady', $this, 'addToChangelog'); } protected function addToChangelog(HookEvent $event){ $page = $event->arguments[0]; $oldPage = wire('pages')->get($page->id); $oldPage->uncache(); foreach($page->fields as $field){ $value = $page->get($field); $this->log->save($oldPage->get($field).'=>'.$page->get($field)); } } When I try saving a page with new data I just get the entered values on either side of the log line.
  20. Hi, I'm trying to create a changelog module but I can't figure out if it's possible to access the field values before they are saved. I assume saveReady is run just before the page is saved, so I should be able to get the page with it's old values, but so far I haven't had any success. Thanks, MadHatter
  21. The issue with this is that the results from the first search will get replaced when the second PageArray is appended if there is an overlap in the results. For example, one of my searches returns back 1 result intially, then the second search returns back another 4. The single result form the first search is in the second search so it gets moved in the final PageArray due to being replaced. With my extended class there is no removing of pages so it maintains the correct ordering I require.
  22. @Soma is it still unique if you append one PageArray to the other? I've just tried reverting back to the append() function but it's still showing my results in the wrong order (i.e randomizing all the results instead of showing me my exact results before the extended search results). If I use the appendUnique() function then I get them in the order I need them. @kongondo The sort function only helps for sorting by a field, what I'm trying to do is find results where the title of the page matches the query string, randomzing it, then searching the summary and content for the same string, randominzing that, then adding that to the end of the first result. There are more searches to take into account (due to some ridiculous client demands) so I need to append the results of each one to the end of the PageArray and check each is unique. My extended Class seems to work fine, my question was really about where to place the code for the Class.
×
×
  • Create New...