Jump to content

louisstephens

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by louisstephens

  1. I actually did exactly as wbmnfktr suggested in a previous project (still in development). At first I was a bit hesitant of having to create new ingredients every time I wanted to add a new unique recipe, but the pros quickly outweighed the cons. It makes filtering on the front end a lot better/easier, as well as makes new recipes easier.
  2. So I was tinkering around with the "select fields" field type and added it to a repeater. My thoughts were I could have a user select a field (textarea, text, etc etc) that I defined and give it a name (another field in the repeater) and create their own form on the page. To be honest, I am now a little lost with rendering the form and mailing the results as potentially the form will be unique and custom every time. The only way I know to handle the output is by going about it this way: $forms = $page->form_select_fields; foreach($forms as $form) { if($form->name === "form_input") { //output input with custom name } elseif($form->name === "form_textarea") { //output input with custom name } } Is there a better way to go about rendering the elements from the repeater? As far as the custom sending goes, I am really at a loss since it would be pretty dynamic. Has anyone used this type of approach, and if so, how did you handle this without going insane?
  3. I haven't had this issue yet with file attachments. However, I have had several timeouts with a very simple form (4 inputs) that create new pages using the wiresmpt module.
  4. I have noticed this for awhile now. I guess I just always assumed that it "opens" the page tree for what you clicked on: - Parent Page (id:1) -- Sub Page (id:2 - has 4 children) -- Sub Page (id:3) --- Sub Sub Page (id: 5 - currently open) -- Sub Page (id:4) If you were on the "Sub Sub" page of id 3 and clicked on the Sub page with id of 2, it would "open up the tree on id 2 and collapse the rest of the tree. Well, that has been how it has been for me.
  5. Have you looked into Admin Restrict Branch: https://modules.processwire.com/modules/admin-restrict-branch/ ? This should allow you to achieve the first part of your post.
  6. Thanks @bernhard! That was exactly what I was looking for. Now I'll continue down the path of learning hooks, and hopefully stop making mistakes like: $p = new Page(); $u->template = "scripts"; $u->parent = wire('pages')->get($page->id); $u->title = "Test"; $u->name = "test"; $u->save(); Which obviously just blows up in your face.?
  7. So I have been diving into hooks lately, and I am enjoying them thus far. However, I guess I am a bit stumped on how to achieve what I want too. I am trying to set up a hook that would create a new child page when the parent page is saved. However, when you save the parent page a second time, I just need to update the child page without creating multiple child pages. What would be the best way to go about this? So after rereading my post, I believe it is a bit vague so I will try to explain more. The Goal: Create a page with a template "one". Once the page is created/saved => create a new child page with the template of "two" If the parent is saved anytime after, do nothing to the child page (limit the parent page to one child page) The parent page is really just being used to output content, whereas the child page is being used to pull out the some fields from the parent to be used elsewhere. I might have made this too complicated in my head.
  8. If you look in that specific file, do you see the following: /** * ProcessWire namespace aware version of PHP's class_parents() function * * Returns associative array where array keys are full namespaced class name, and * values are the non-namespaced classname. * * @param string|object $className * @param bool $autoload * @return array * */ function wireClassParents($className, $autoload = true) { if(is_object($className)) { $parents = class_parents($className, $autoload); } else { $className = wireClassName($className, true); if(!class_exists($className, false)) { $_className = wireClassName($className, false); if(class_exists("\\$_className")) $className = $_className; } $parents = class_parents(ltrim($className, "\\"), $autoload); } $a = array(); if(is_array($parents)) foreach($parents as $k => $v) { $v = wireClassName($k, false); $a[$k] = $v; // values have no namespace } return $a; }
  9. As far as I can tell, it might not be possible yet. There seems be some "work arounds" that can be found here: https://stackoverflow.com/questions/30121969/making-a-private-githubs-wiki-public https://help.github.com/articles/changing-access-permissions-for-wikis/ (though I am not sure what can truly be done here, as I dont have github pro account. With the "free" private repo, you lose access to wikis)
  10. Yeah, I just learned about it this past Monday, and I was pretty excited. I believe the only "catch" is that you can only have 3 contributors on the repository.
  11. From my last post, I was given a good idea on how to count the repeater items, and it worked wonderfully. I got my code working well and the columns (based on the count) all work well as well. Now, I have a head scratcher on my hands. <?php $buttonsIncluded = $page->special_custom_buttons->find('special_custom_buttons_include=1'); $buttonsIncludedCount = count($buttonsIncluded); $buttonsIncludedCountAdditional = $buttonsIncludedCount +1; echo $buttonsIncludedCount; ?> <div class="row"> <?php foreach($buttonsIncluded as $button): ?> <?php if($button->custom_buttons_include): ?> <?php if($buttonsIncludedCountAdditional == 2): ?> <div class="col-6"> <a href=""><?php echo $button->custom_buttons_text; ?></a> </div> <?php elseif($buttonsIncludedCountAdditional == 3): ?> <div class="col-4"> <a href=""><?php echo $button->custom_buttons_text; ?></a> </div> <?php elseif($buttonsIncludedCountAdditional == 4): ?> <div class="col-3"> <a href=""><?php echo $button->custom_buttons_text; ?></a> </div> <?php endif; ?> <?php endif; ?> <?php endforeach; ?> </div> All of this is included in a larger foreach statement that is pulling in other data (like body copy etc etc) from a Page Table field. As you can see in my code above, I am adding "1" to the count, so I can have space in the grid layout for a new button. So, right now: it looks something like: [repeater button] [repeater button] [repeater button] [space for new button] What I really need to do is to pull in the button from the Page Table and add it into the new space so it looks like: [repeater button] [repeater button] [repeater button] [button from Page Table] Is this even possible todo, or is there a better way to go about this? *Edit* So, I really just overlooked something quite easy here. Since the grid is based on 12 columns, I could just take 12 and divide by $buttonsIncludedCountAdditional which would give me the remaining col width to use outside the foreach loop. I was trying to make this too complicated.
  12. Is it possible to use count() to return a number of repeater items don't have a checkbox checked? In my current set up, I have a repeater on the page "dev_repeater" with a checkbox called "dev_repeater_exclude". I need to get a count of the current items that do not have it checked so I can pass it to my css grid to alter the column width.
  13. I believe you are right in thinking that it only works with "field!=something (though please correct me if I am wrong). However, there is this module https://modules.processwire.com/modules/custom-inputfield-dependencies/ that might help you out a bit in your quest.
  14. Thanks Sergio, I had it open in my browser and just forgot to post it ? . However, I did find if the video is unlisted, then there are still no related videos shown.
  15. So I don't know how many have noticed yet, but Youtube has depreciated "rel=0" at the end of the embedded url in September 2018. For some reason, I just noticed today on a site I was working on. If you do not use the rel, you will get related videos across youtube, but if you use it, you will only get related videos from the same channel. Just wanted to share in case people did not know and they needed to make a change on whatever they were working on.
  16. I really like the new design Ryan! I have only one suggestion; would it be better to move "Getting Started" to somewhere a little easier to find for new users? Thus far, I have only been able to access it here, and it is tucked away from the main sidebar on the right.
  17. There is a "solution" posted on stackoverflow that might fit your needs.
  18. I currently use the Cobalt2 Theme by Wes Bos, and I like it thus far. I believe in his themes he uses a paid font for functions etc, so I found something similar to use in my own: It took me a few minutes to get use to the new font, but I like it a lot now. To me the theme is a nice alternative to the dark theme that I use to love so much.
  19. Hey Leftfield, it might help us better answer your question if you can describe in more detail your current template set up. For example, I use a template structure where the head is included into every template utilizing <?php include("./inc/header.php"); ?> This way, I call some global settings in the head, and it is included everywhere. However, some people use the delayed output approach.
  20. Well, In your template file, you could do: <link href="<?php echo $page->httpUrl; ?>" rel="canonical" /> This would produce something similar to https://domain.com/parentpage/childpage or however your site is set up.
  21. If you use Robin's field width module, the columns appear to work just fine. This might be a "work around" until Ryan has a chance to update the Uikit.
  22. Hey dreerr, are you currently viewing the admin on mobile? I ask only because in your screenshot, the tab looks to about about 50%. From my understanding, if the width of the fields/container are 50% on mobile (or smaller devices), the fields will collapse and stack accordingly.
  23. Just a quick question, when you look in the assets folder, are all of your images there?
  24. From what I understand, you could create/publish pages regardless of roles/permissions. However, if you were to wrap the page creation in an if statement like : if($user->hasPermission('permission-name', $page)) { // user has this permission, for this $page } then that person with the permission could perform whatever action you created.
×
×
  • Create New...