Search the Community
Showing results for tags 'scripts'.
Hi all, Not sure if this has been asked already but... Recently came across an agency with a build script for PW! I was amazed and also bemused, as alot of the script was used to create the right fields and templates in the DB from other local copies, and they'd done this by separating out tens of JSON files with individual field / template export data and sticking it back together on deploy creating new id's adhocly. (a far as i could see as id's were ommited) Anyway, in my experience I've always felt that export profile and profile installing has worked well for buiding for live as you get a stable install with your site template, fields and pages. If anyone has any scripting experience with PW I would love to know: Anyone else use build tools? What do you use them for with PW? and what languages/environment you use to create them?
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.
Hi I try to build a simple basic responsive layout / profile with pocket grid... So it would be great to set additional values as variables. IE conditional comments could be build by a module to generate the needed code. I would use $config->styles and $config->scripts to build a filenameArray with needed css and js files. But how could a add additional values like media attribute or IE condition? Any idea to keep it simple? Last site media query styles were hard coded at page template file (a templateFile template ) before output $config->styles ... Maybe the media queries stylesheets with additional media information could be saved in a (config) page, but need a field with two textfields (filename, media information). Which fieldtype should be used in such a case? repeater, ProField table, ...?
My site has several pages that require access to one-off scripts the rest of the site doesn't use. To keep pages loading as fast as possible we don't load these scripts on every page. Instead, we typically include them on a per-page basis in an extra block loaded after the footer html. When I first started trying to port to PW I added textarea fields for "extra_head" and "extra_footer" into my primary template, and I hoped I could include these script loading directives in the "extra_footer" block and be off to the races. In fact, this would have worked beautifully if I had hard-coded paths for these scripts. There's the rub, however! I was trying to do things the PW way, so I used the php directives to get the path to my site's "templates" folder. When I output this "extra_footer" field in the page, the php doesn't get executed, so I never get the script path, and the whole thing fails. <script src="<?php echo $config->urls->templates?>static/js/jquery.isotope.js"></script> I don't know if I have output the field in my template the wrong way, so maybe there's some other php or api call that will cause it to actually interpret the code in this field during output? Here's what I have used: <?php echo $page->extra_footer; ?> I had this problem in other places, too. For example, during the port of the site we decided to start out with a "body" textarea that we bulk-dropped the html markup from the previous site into. This html had references to images and other static resources that we tried to access with the same type of php path reference as in the example above. Of course, none of it worked because that php code never gets executed. Is there a way to have the php in fields get executed during the page production? If not, is there some other reasonable way to get the path to site resources like scripts and general-purpose images (that wouldn't usually be included in a page's "images" field? Thanks, Rick