Jump to content

Convention


pwnewbie
 Share

Recommended Posts

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

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

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

@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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...