pwnewbie Posted October 6, 2015 Share Posted October 6, 2015 I've read several of the tutorials, just wondering what is a better convention, use .inc or.php extension (e.g. main.inc or _main.php)? Why have two naming conventions? Never mind,I think I got this mixed. main.inc you include,also called main.inc strategy, the _main.php is a different delayed strategy (_init.php, template, then, _main.php executes). Two different things. What to choose? I think the _main.php is more flexible. Link to comment Share on other sites More sharing options...
pwired Posted October 6, 2015 Share Posted October 6, 2015 Hi, and welcome to Processwire. Never mind,I think I got this mixed. main.inc you include,also called main.inc strategy, the _main.php is a different delayed strategy (_init.php, template, then, _main.php executes). Two different things. What to choose? 1. Technically, the underscore in _main.php is simply a way to make Processwire identify this as an include file rather than a regular template file. http://processwire.com/docs/tutorials/default-site-profile/page2 2.The _main.php file is simply used in a different output strategy. Rather than splitting the markup into _head.php and _foot.php files, all the markup is instead contained in a _main.php file, which represents an entire HTML document. http://processwire.com/docs/tutorials/default-site-profile/page3 The reason behind all this, is that Processwire allows you to choose different strategies to make your website scalable, e.g. making maintenance much more easy. Link to comment Share on other sites More sharing options...
pwnewbie Posted October 6, 2015 Author Share Posted October 6, 2015 @pwired, thanks for your reply, the other delayed output strategy main.inc seems not to have any advantage compared to the 2nd one you mentioned (i.e. with the _main.php). Is that correct? Link to comment Share on other sites More sharing options...
pwired Posted October 6, 2015 Share Posted October 6, 2015 Yes that's right, the main.inc file is part of the Delayed Output, also known as the main.inc strategy https://processwire.com/docs/tutorials/how-to-structure-your-template-files/page4 The main.inc file is further explained in the comments down this page: http://processwire.com/docs/tutorials/how-to-structure-your-template-files/page5 Link to comment Share on other sites More sharing options...
pwnewbie Posted October 6, 2015 Author Share Posted October 6, 2015 I see, I need to test this stuff....main.inc, the includes can ballon, the _main.php seems more flexible. Link to comment Share on other sites More sharing options...
Mike Rockett Posted October 6, 2015 Share Posted October 6, 2015 Hi pwnebie, and welcome to the forums. If you're ever keen on separating things properly (which is much nicer, and easier to maintain), give TemplateDataProviders a try. TemplateTwigReplace also works really nicely with it. Link to comment Share on other sites More sharing options...
pwnewbie Posted October 6, 2015 Author Share Posted October 6, 2015 @Mike Rocket, thanks for the welcome and advice, modules looks good, I'll test them out. 1 Link to comment Share on other sites More sharing options...
bernhard Posted October 7, 2015 Share Posted October 7, 2015 hi pwnewbie and also welcome to the forum theres lots of useful information regarding the delayed output in this thread: https://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/ maybe my illustration of the intermediate profile (using delayed output) is also helpful: https://processwire.com/talk/topic/9690-sub-templates/?p=93247 i hope you enjoy processwire as i do Link to comment Share on other sites More sharing options...
pwnewbie Posted October 9, 2015 Author Share Posted October 9, 2015 @BernhardB thanks for the welcome and tips, yes I'm enjoying processwire, I only notice it's kind of unresponsive in a local environment, but is acceptable in live host. Link to comment Share on other sites More sharing options...
SiNNuT Posted October 9, 2015 Share Posted October 9, 2015 @BernhardB thanks for the welcome and tips, yes I'm enjoying processwire, I only notice it's kind of unresponsive in a local environment, but is acceptable in live host. PW normally is faster than most CMSs i've dealt with. In my experience, when things are unresponsive this is caused by factors outside of PW itself. I don't know your local environment but some things you could try are: Open the file site/config.php, lookup the dbhost setting and change as follows: $config->dbHost = '127.0.0.1'; //instead of localhost I have not been able to figure this out exactly, but on Windows (>8) machines, letting PHP connect to your database via localhost is very slow. On my own machine if i use localhost i get 2-4 seconds of unresponsiveness. When i use 127.0.0.1 everything is back to its normal snappy self. If you're on Windows here is some more info and things you can try if the above didn't help http://stackoverflow.com/questions/8432601/wamp-xampp-is-responding-very-slow-over-localhost Another thing you can try is opening your PHP configuration file and comment out everything XDEBUG related. Xdebug is known for slowing things down because even when you are not using it to debug things it does collect a lot of data for its stack trace stuff. As an example, here's the stuff i've commented out in my PHP ini file: [xdebug] ;zend_extension=${US_ROOTF}/core/php56/extensions/php_xdebug.dll ;xdebug.remote_autostart=on ;xdebug.remote_enable=on ;xdebug.remote_host=127.0.0.1 ;xdebug.remote_port=9000 ;xdebug.remote_handler=dbgp ;xdebug.remote_mode=req ;xdebug.idekey=default As for your live host, 'acceptable' does not sound that great. PW should run great on most hosts. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now