-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
Nice Idea, reminds me of the modules I was doing to improve usability here and there like the "stay on tab" feature when editing/saving the page. One thing that wasn't obvious at first glance, is that you can get back to where you were using the breadcrumb. If you click on the parent you'll get back to the page list with the page hierarchy open. This is something I learned to love, because it is optional. I don't think I like when the tree alway is open where I left, because I might don't want to go there and it's making assumptions... This is also one reason of why Ryan don't liked to implement such a feature (it was discussed a while back).
-
Thanks Ryan, that's what I also tried and still get's appended as the first script. "...and move your script load to your execution rather than initialization." What? execute? instead of init() ?
-
Coming back with the all time favorite of me, appending scripts. If I create a new js module, it gets appended before the jquery core scripts at first position. How can I add scripts after, or at certain position? <?php class MyJSModule extends ModuleJS { public static function getModuleInfo() { return array( 'title' => 'MyJSModule', 'version' => 1, 'summary' => 'test', 'href' => '', 'autoload' => true ); } public function init(){ parent::init(); } // note ModuleJS automatically loads any JS or CSS files with the same basename as this module } And the output is this: <script type='text/javascript' src='/site/modules/MyJSModule/MyJSModule.js?v=1'></script> <script type='text/javascript' src='/wire/modules/Jquery/JqueryCore/JqueryCore.js?v=162'></script> <script type='text/javascript' src='/wire/modules/Jquery/JqueryUI/JqueryUI.js?v=180'></script> <script type='text/javascript' src='/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.js?v=102'></script> ...
-
Welcome! Thanks, glad you found it out on your own. I wanted to add that you also need echo it echo $page->field_color;
-
Welcom eomine! What testing purposes? I think there's no way, cause PW uses paths and segments to resolve to a page.
-
I already provided and example to make that code simpler and working with php < 5.3... https://github.com/mindplay-dk/TemplateDecorator/issues/3#issuecomment-8997263
-
I just pushed an update and is now to 1.1.2. It was easier than first thought. Thanks apeisa for finding it.
-
Glad you found out the mystery. Well that's why we do: if("home" == $page->parent->name) Because like this if you miss one "=" it will throw an error.
-
Well it gets kinda complex, and my guess is since there's no childs output it doesn't get added. I'm not sure how easy it will be to add it.
-
I updated the repo, to fix the inputfields.js problem. It was there but I named it wrong.
-
$page->render() isnt generating the same output as viewing a page
Soma replied to ArtArmstrong's topic in General Support
Usually you get this as url, if there's no image uploaded. Or you're having a multiple image field and you'd have to call $a->feature_image->first()->url to the first image. Do you get the right image src's when you call the "page" directly? -
$page->render() isnt generating the same output as viewing a page
Soma replied to ArtArmstrong's topic in General Support
Ahhh there's a module? If I do something like this from an autload module, it still works as it should. public function init() { $this->pages->addHookAfter('save', $this, 'renderPage'); } public function renderPage(HookEvent $event) { $page = $event->arguments[0]; $file = wire("config")->paths->root . "xpage.html"; wire("config")->urls->root = "http://pw2-dev.ch/"; $page->of(true); file_put_contents($file, $page->render()); } xpage.html saved and with correct markup. -
Yeah I noticed that too. It's because of a new js file introduced in core admin template. I merged the content of it inputfields.js to the main.js in the theme, so everything works as the functionality is there. I'll later update that.
-
$page->render() isnt generating the same output as viewing a page
Soma replied to ArtArmstrong's topic in General Support
Do you get any notices or errors? Are you really sure? Because this is somehow "wrong". If you're rendering you have OF on anyway, so this code won't do anything. In cases where you want to modify and save fields you have to call $page->of(false) to turn off OF. I can't spot anything wrong from your code and rendering a page like this works perfectly. ..$a->featured_image->url->description;... Shouldn't it be $a->featured_image->description ? Also some more details, anything you can add would help us. Oh and welcome! -
You could also have one template use the fields of another template (share them). If you have the same fields, data will also be preserved. But you can't edit the fieldset, it will just mirror them from the one you choose. You can also switch back to the old fieldgroup. You have to turn on advanced mode in config.php to see this option. It will show up underneath the add fields. template->basics->fieldgroup.
-
If there are fields which are equal you can simply change template and those will be preserved.
-
You can point the subdomain to your normal main domain. From there you could use a "proxy" page to "load" a template to load the page. An elegant solution might be to use have your templates use the same "proxy" template. The alternative template name setting can be used to do this found in advanced tab. Then create a proxy.php in the /site/templates folder. Here a code example: if($_SERVER['HTTP_HOST'] == m.domain.com) { // template for mobile include("./mobile/".$page->template->name.".php"); }else{ // desktop template include("./default/".$page->template->name.".php"); } Then put your different templates each to a corresponding subfolder. /site/templates/mobile/... /site/templates/default/... Another route would be to try symlink PW core folder and separate the site folders and use the same database and setting in config.php or symlink it too. This of course requires you to be able to create symlinks on the server. processwire/wire processwire/site /assets /modules domain.com /wire (symlink to processwire/wire) /site (local) /modules (symlink to processwire/site/modules) /assets (symlink to processwire/site/assets ) /templates (local) sub.domain.com /wire (symlink to processwire/wire) /site (local) /modules (symlink to processwire/site/modules) /assets (symlink to processwire/site/assets ) /templates (local) I think this is easy possible, just have to make sure same template files exists in both local /site/templates folder. I would try something with first example.
-
Marc can you show a little more of what you're doing exactly? I can't think of anything that would produce this, so far it works without known problems.
-
"isNew" is a porperty or method of Page Class. So logically it does not work when using that field name. Thanks for finding it. This shouldn't happen and give an error when trying to name a field which will interferer with any page system properties.
-
In that case you need to construct your own pagination. Pagination only works with 1 page query.
-
like this? $parents = array(2293,1038); $photos = new PageArray(); foreach($parents as $parent) $photos->add($pages->find("template=picture,has_parent=$parent,limit=20,sort=-created")); $photos = $photos->sort("-created")->slice(0,20);
-
has_parent works only for 1 page.
-
Ryan you reached the thousands likes! WOW, can I have some?
-
It saves state normal for me. But lately I see a "1" as the checkbox label, which I don't like really and I can't seem to change it. Edit: Ok dropping in the very latest 2.2.9 solves my issue with checkbox. Weird to say that...