Jump to content

Search the Community

Showing results for tags 'Config'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 39 results

  1. Does using dedicated module files help a lazy programmer? For a private helper module I wanted to built, I decided to use the possibilities of dedicated files (implemented in PW 2.5.5) and not to write all into a single module file. Until now, I totally missed or forgot about this possibility. To my excuse: on introduction I may have thought not to use it early in my modules to keep backward compatibility. And then totally forgot about it. I allready use a tool for postprocessing in my sites. And I'm not familiar with all those popular node/grunt/gulp/npm/bower/and-what-else stuff out there. It looks to me a bit oversized for small to medium websites. But I also wanted not miss a comfortable, easy to use config for less and sass files, especially for those from frameworks like Bootstrap 3 / 4 or UIKit. So, what my toolbox should get added was a preprocessor (compiler) for sass (.scss) files first. I choosed the UIKit for the first shot. The created files for a configurable module called PreAndPostProcessor and a process module called ProcessPreProcessor were: PreAndPostProcessor.module PreAndPostProcessor.info.json PreAndPostProcessorConfig.php ProcessPreProcessor.module ProcessPreProcessor.info.json ProcessPreProcessor.css ProcessPreProcessor.js As you can read about the differences to the old-schooled style in Ryans blog post, I focus on what I found out to be most useful for me. Starting with the Config file, I decided to use the $this->add() method in the __constructor(). It is the way what needs less code to define your inputfields for a configpage: just a collection of arrays with field or fieldset definitions. Mandatory definitions are: type, name, label. Others are optional: description, notes, required, columnWidth, collapsed, showIf, ... And, of course, you need the definitions specific to your fieldtypes (value, options, ...). To group some fields into a fieldset, add a key called "children" to the fieldset array and add all field definitions to it as collection. Simple! Another nice thing I discovered, is the use of the *.info.json files. So, this I have used before, but not like here. The behave is like with the *Config.php files, - you write really less code, just arrays with key - value pairs and PW does the rest for you! Only difference here is, that you have to write it in JSON notation. The ProcessPreProcessor.info.json file contains the neccessary and common parts: title, version, requires. And some others: permission, permissions, page and nav. Page and nav are specific to Process modules. With page {name, parent, title} you define where PW should create you a page in the admin, and with nav, you can define a complete submenu for this page. For those who are yet not familiar with the internal structure of Processmodules: you can navigate to a submenu entry by calling it: {pw-admin-url}/{main-module-url}/{submenu-url}/. Calling the main menu url invokes the ___execute() method of the module. Calling a submenu url invoke the ___executeSubmenu() method. This all is really simple and straight forward. And it is really really helpful in cases like with the new toy for my toolbox. The nav is a collection of arrays, each holding at least an url and a label. Thats enough for PW to implement the menu and submenu for you in the admin. But you also may define an icon too. Aaaand, you also can add your own custom key / value pairs to it. PW does not complain on it. I have added a description. The nav was generated by parsing all core distribution scss files from the UIKit. They have a name and description in their first two lines. I programatically read this out and generated this nav notation for the info.json file: The (main) ___execute() method of the ProcessPreProcessor.module should present a submenu list with file infos. This now could be done by parsing the info.json file: public function ___execute() { // generate a navigation $dump = json_decode(file_get_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.module') . '.info.json')); $nav = $dump->nav; $out = "\t\t\t<dl class='nav hnpp'>\n"; foreach($nav as $obj) { $out .= "\t\t\t\t<dt><a href='./{$obj->url}'>{$obj->label}</a> ></dt>\n"; $out .= "\t\t\t\t<dd>{$obj->description}</dd>\n"; } $out .= "\t\t\t</dl>\n"; return $out; } To make it even more friendly for lazy devs, , I created one method that is called from all sub-execute methods by simply passing their own name over into this function that loads and parse the scss file and displays its config page: The first version work out nicely. Here is a screenshot of it: ... and to answer the initial question: Yes, it does!
  2. Hello, I am using Antti Peisa's Multisite module. For those people who are not familiar with it. Here is the link: http://modules.processwire.com/modules/multisite/. It works like this: It gets the current URL that visits the page via $config->httpHost and then redirects to a page who has the same name (e.g. get it via: $pages->get('/www.multi-site.com/')). The problem: $config->httpHost is locally something like "multi-site.local" and the redirection does not work because the ".com" url is hardcoded as page name. So I thought: Why not solve this problem by replacing the value of $config->httpHost in a module via: $this->wire->config->httpHost = str_replace('.local', '.com', wire('config')->httpHost); Is this a good way of doing this? And if yes: How can I say that my module loads first in the booting process? Are there any dangers with this approach? If so: any better ideas? I am not a great programmer Thank you!
  3. There's a relatively new Config module which enables setting basic config options directly in the admin. Was wondering if you could clear up some points as I'm a bit confused regarding the process and which files take precedence. Q1: Risk of wire/config being overwritten If we want to add a custom Configuration property under the Core tab, we are supposed to edit wire/config.php. For example, I made a new test property in wire/config.php. Refreshing the Config module successfully displays my custom property. Yet on the official docs it states that wire/config.php should not be edited as it'll be overwritten. Q2: Precedence or inheritance of site Vs wire config So, should custom settings instead be setup in site/confing.php? I don't think they should as adding new Configuration settings here has no effect on wire/config.php or the available Config Module properties Q3: New Site tab Again, adding anything to the site/config.php has no effect on my Config Module and the tabs are only. Core | Custom and Remove. Yet the documentation differs here.... I'm wondering if the Custom tab is what you meant instead of Site? Q4: Site Title In the current Custom tab, there is a Config property called Site Title. Where is the Config Module reading this from? It's not set in Site or Wire config.php that I can see.
  4. I have IIS 8.5 running PHP 5.6 and i can't get Processwire to work. Normal PHP executes, but when i go to processwire it's just a blank page, even trying to display PHP errors just returns a blank page. my web.config is as follows (which worked on a previous windows processwire setup) <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="CLEAN URLS" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php?it={R:1}" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> </configuration> Can anyone with IIS and windows server knowledge help out?
  5. If i have a template that requires scripts added in head and at the end of body. Do you have any idea how to handle this whith $config->scripts. Another point is how to handle if its necessary to add not just files but small scripts that need to be added at the head or bottom.(like google analytics). Is there something like : $config->scripts-bottom $config->scripts-direct Maybe there is a way to make such an array, besides from silmply creating the var.
  6. Hi, I try to move my website. I already moved the database, changed the config.php content, but I get: Parse error: syntax error, unexpected T_VARIABLE in www/v3/index.php on line 106 the line 106 contains: $config->paths = clone $config->urls; What did I miss?
  7. Hi Guys, I have processwire installed on a site which was working fine up until very recently. I am getting the error Unrecognized HTTP host: My config file is as follows; $config->httpHosts = array( 'localhost', // our primary hostname 'corrymeela-cms.3sixtynearlythere.co.uk', // staging server 'www.corrymeela.org' // Live server ); I have updated the htaccess file to the most recent. I cannot update any content at the minute I am getting this error: Cannot be published until errors are corrected Can anyone help please? Warmest wishes, Mel
  8. I'm working with a PW 2.5.3 install. Here http://processwire.com/blog/posts/processwire-core-updates-2.5.14/ there is a quick tutorial on setting up an alternate user template and parent. I followed it to the T, but it didn't work; when adding a new user, there was no choice of template, and once the user was created the alternate template I had set wasn't even among the select options. Has anyone managed to do this or even just an alternate template successfully? The alt. tpl. is what I rly. need... I just tried it twice over and then erased and undid everything 2x too, so... Then I only unchecked "Don't allow pages to change their template?", cloned user template (id=75), added "$config->userTemplateIDs = array(3, 75);" to config.php created a new user No alternate template option still. This should be able to work right? Because I don't see a date for that blog post but do only see comments from 5 days ago, but it says 2.5.13, I'm using 2.5.3.
  9. I added some input fields to the Textarea input tab with a hook: $this->addHookAfter('InputfieldTextarea::getConfigInputfields', function(HookEvent $event) { // field generation here }); The fields are rendered perfectly, all fine here: When I hit "save" the new config values are saved to the database. This is what I see in the field's config in the fields table, all fine, great: {"textformatters":["TextformatterParsedownExtra"],"inputfieldClass":"InputfieldTextarea","collapsed":2,"rows":16,"contentType":0,"trackChangesInterval":777,"cssTheme":"theme-solarized-dark"} But when I want to access the new saved data from anywhere, I can't, it's not there. Only the standard values from textarea are there but not the custom ones. What else do I have to do to make them accessible from the respective fields instance? The are there but do not seem to be added/set to the instances. PS: PW's docs need some serious work =( Thanks!
  10. Hi, I wanted to know if it is ok to change the session name in config.php from 'wire' to 'PHPSESSID'? i.e, from: $config->sessionName = 'wire'; to: $config->sessionName = 'PHPSESSID'; Are there any repercussions of doing this?
  11. I have searched the forums and PW documentation and can't find anything on this topic. Is there a config someone has implemented for using PW in multiple environments? I'm using Git with DeployHQ to deploy changes and would like a config that will detect which environment the site is on thusly loading the appropriate DB details.
  12. In case you didn't know or had forgotten, in PW you can edit /site/config.php and set $config->debug = true; to help track down errors. I've often found 'soft errors' (bad practice PHP etc (something you get if you are PHP 'lite' like I am)) that were previously hidden are displayed when this is set to true. But I also found I set it and forget that it's set then sometimes see a page load slightly slowly or with a visible 'flash' and wonder what's wrong, only later remembering I have debug left on. So now as a reminder I echo (if the setting is true) a reminder somewhere obvious such as adjacent to the homepage (or every pages's) H1. It's good to be reminded since going to a production site with it set to true is NOT recommended (API doc). This is the simple test and echo I now add: if(wire('config')->debug) echo "<span class='alert'>Flashy? Slow? Probably because of \$config->debug = true;</span>";
  13. Title says it all really? Any idea why config->urls->root would display nothing? I'm guessing it may have to do with my config file but I've never seen this issue before... Thanks
  14. hello forum, i'm an absolute newbie to pw who has worked (and still works) with textpattern and contao. i have a firm grasp of html, css and some of jquery but very little of php (not to say nothing at all 8) ). i came across processwire and it looks very, very promising to me. i installed locally on xammp. however, immediately i'm having my first questions. pleas apologize, if this are silly questions from a pro's point of view: - on finishing the installation i got the following message: but how do i do that? does that refer to the permissions my ftp user has? and what would be the right permission (0000)? - within /site/config.php i found the following comment: does that mean, all directories processwire will creates will have assigned 0777 permissions? this doesn't matter to me on localhost, but live, in a shared hosting environment, this seems to be a high risk. if so, is that really necessary or can it be overcome somehow? thanks for answering and for your time! totoff
×
×
  • Create New...