Kevin C. McCarthy

Members
  • Content Count

    18
  • Joined

  • Last visited

Community Reputation

1 Neutral

About Kevin C. McCarthy

  • Rank
    Distinguished Member
  • Birthday 03/01/1984

Contact Methods

  • Website URL
    https://www.standardforge.com

Profile Information

  • Gender
    Male
  • Location
    New Jersey

Recent Profile Visitors

2,651 profile views
  1. Kevin C. McCarthy

    I am desperate to learn how to you ProcessWire to it's fullest potential, and while the documentation is great and always appreciated, I simply can't follow along because it gets way too technical without really showing how applicable and versatile it can be. Then again, I'm almost a moderate understanding of PHP and no experience with APIs or programming JavaScript—so it's probably leagues ahead of where I am at the moment. That said, I learn best by watching and the doing. Think Codecademy or FreeCodeCamp. I was wonder if there are any video tutorials or walk-through lessons to give me a greater understanding of ProcessWire and how to utilize it effectively. For some background, I'm great with WordPress and I'm great with writing websites by hand with Notepad only. The biggest hurdles I have with PW is the phrasing is so far left of WP at times that it's a massive hurdle for me to get over. Like in WP, themes, templates, etc are totally different things. And as someone who builds WP sites for a living, it gets hard to kill those old preconceived meanings. I want to start building out PW sites for numerous reasons. For one, most of my clients they would benefit from it vs the Bloated Beast. Two, it would allow me to differentiate me in a market saturated by WP devs. I know I have a long ways to go until I reach that point of considering myself a "PW dev", but I am desperate for resources to help me wrap my head around it. I've built my own website in PW but TBH it only handles some of the data while most of the text has been hard-coded into the PHP template files because I couldn't get my my head around the "best practice" of structuring the data. Anyway, enough rambling, I'm just hoping those of you in the community can point me to easily-digestible sources out there that can help move me along so I can actually benefit from using the platform. Thank you!
  2. Kevin C. McCarthy

    Love the module! I was wondering if there was a way to add Schema.org markup support for the menus? If you look at "Site Navigation Schema Markup" on this site, you'll see that there is markup that should be added to get menu pages to show up with Google results. I would like to take advantage of this. Given the simplicity of the markup, I feel if it were to be put into this module, that it would make sense to enable with a checkbox on each separate menu created. (So I would enable on the "main" menu, but not the menu on the footer, if that makes sense.) Thanks! EDIT: I ended up hand-coding it into MarkupMenuBuilder.module at lines 367 and 368, which is good and achieves the proper result (and validation) but unfortunately creates 2 schema menus...there is a menu on top and one at the footer. I only want one schema menu, which is the longer one in the footer. I knew going in that it would likely do that, but it's certainly preferable that it doesn't. Also, when the module gets updated, it will wipe that out and it'd have to be done again. If this could be built in that would be great. BTW, I'll attach my code below (and my neurosis prefers double quotes in rendered HTML rather than single )... if(!$iTag) $out .= "\n\t<a{$itemCSSID}{$class}{$newtab} href=\"{$m->url}\" itemprop=\"url\">{$m->title}</a>"; else $out .= "\n\t<{$iTag}{$itemCSSID}{$class} itemprop=\"name\">\n\t\t<a{$newtab} href=\"{$m->url}\" itemprop=\"url\">{$m->title}</a>";
  3. Kevin C. McCarthy

    Greetings PW Community, A long time ago I was using Pixelpost as my go-to photoblogging script. It had limitations, but it was good for what it was: a PHP script to allow me to post one photo per day. It's been nearly 7 years since it was updated and as I'm looking to get back into photoblogging, I'm wondering how I can accomplish the same tasks but ultimately even better with Processwire. The biggest appeal to me is the ability to go above and beyond what Pixelpost provided, and with my very limited PHP knowledge, this is a huge plus. I've attached a screenshot of the back-end for reference, but I basically want to create a page, when posting for the day, allows me to have all (or most) of those options. The main site had the ability to load the latest post as it's homepage, as well as cycle completely around, back and front, with navigation buttons. It also allowed EXIF data to be extruded and displayed in the description. If you would like to see what it came out like, you can check it out in it's current (though neglected) form here. My first goal is simply, to the best of my ability, duplicate the old site's function. And then, as I figure that out, expand it outward with various other features that I'm planning such as uploading more than one image at a time (so there'd be this "halo" image that you can click around and see other shots--maybe up to 10--that I took on a particular trip). Eventually, expanding to adding locked-down galleries for photography clients. Does anyone have a way that might be easy to digest as to how I can accomplish this? I'm already thinking fields for (at least how I'd name them) "photoblog_img", "photoblog_img_title", "photoblog_img_desc", "photoblog_img_tag" (not sure how tags would work), "photoblog_img_cat" at the very least. I'm not sure how I'd handle comments or EXIF data or date/future posting. Thank you!
  4. Kevin C. McCarthy

    I have a question about the iFrame usage. I'm not really against it at all, but I was wondering why not use Ajax to send the forms? I realize there's likely a ton of extra markup that would be required, and it's probably better for compatibility, but it's just something I'm curious about. Or, better yet, is there any way to get it to use Ajax once the module, as-is, is installed? By no means is it a deal-breaker for me regarding the module, I'm just inquiring. Btw, save for HTML/CSS, I'm not much of a coder, so pardon any naive questions.
  5. Kevin C. McCarthy

    I still can't get it. I even put the code and everything as the demo stated, so no custom files or anything, and nothing shows. Here's the error I get when I run the /contact/ page basically as-is from the demo (note: exactly as-is yielded same result)... Sorry, we found a problem with your form entries... Error: Exception: Method TemplateFile::entityEncode does not exist or is not callable in this context (in /home/emerald/public_html/wire/core/Wire.php line 232) #0 /home/emerald/public_html/site/templates/includes/contact-form.php(62): Wire->__call('entityEncode', Array) #1 /home/emerald/public_html/site/templates/includes/contact-form.php(62): TemplateFile->entityEncode('Value is out of...', true) #2 /home/emerald/public_html/site/templates/testform.php(33): include('/home/emerald/p...') #3 /home/emerald/public_html/wire/core/TemplateFile.php(125): require('/home/emerald/p...') #4 [internal function]: TemplateFile->___render() #5 /home/emerald/public_html/wire/core/Wire.php(271): call_user_func_array(Array, Array) #6 /home/emerald/public_html/wire/core/Wire.php(229): Wire->runHooks('render', Array) #7 /home/emerald/public_html/wire/modules/PageRender.module(250): Wire->__call('render', Array) #8 /home/emerald/public_html/wire/modules/PageRender.module(250): TemplateFile->render() #9 [internal function]: PageRender This error message was shown because you are logged in as a Superuser. Error has been logged. Any ideas on this one? EDIT Nevermind, I've just given up and chosen to get Ryan's FormBuilder. However, thank you for the help adrian.
  6. Kevin C. McCarthy

    Thank you for your help so far. I'll update if I figure it out, otherwise it's safe to assume I'm still struggling
  7. Kevin C. McCarthy

    Thank you, I really appreciate it! I forgot to provide this code, which is what the main child page for Contact ("/contact/") has to call the form... [top part of section with html] <? $form = $pages->get("/contact/contact-form/"); // some widget page form->calledfrom = $page; // save current page from where widget is rendered echo $form->render(); ?> [bottom part of section with html]
  8. Kevin C. McCarthy

    I have it put in there because, simply, I'm a bit anal about structure. And the demo that is included with the module has that same file in the "/template/includes" folder - so I changed the appropriate values in the contact form template "section-contact-form.php" to reflect the altered location. However, here's my code for "section-contact-form.php"... <? /** * Actual /contact/ page template * Makes use of the FormTemplateProcessorMailer module for * static contact pages and async'd overlays on other pages */ $ftpm = $modules->get('FormTemplateProcessorMailer'); // specify the to-call url especially for async handled overlay usage $ftpm->set('formAction', $page->url); // the demo uses PHPMailer $ftpm->set('usePHPMailer', true); // the template assignment is required $ftpm->set('template', $templates->get('section-contact-form')); // If you have any additional site-specific, globally required fields that are // not related to the form, you will want to include them in skipFields # $ftpm->set('skipFields', array('title' )); // the parent page for saving these child pages to the database (if desired) // the demo just reuses the static /contact page as the parent but you could use any // @note our /contact page is set as status: 1025 (Hidden: Excluded from lists and searches) # $ftpm->set('parent', $pages->get('/contact')); if ($config->ajax) { include './_inc/php/contact-form.php'; return; } ob_start(); ?> <? include './_inc/php/contact-form.php'; ?> <? $page->body .= ob_get_clean(); ?> <? echo $page->body; ?> Compared to the demo files, I modified the end part of the code because it'll never be used as it's own page, so it doesn't need to use any other template files or includes, and I get the same results even if I use the code from the demo files exactly. Now here's my contact-form.php (which is located in "./_inc/php")... <? /** * This is the templette used by contact.php in the demo. * It is used for custom rendering the form markup, and * also controls async output on ajax'd form requests. * Requires an FormTemplateProcessorMailer object, in * this case created in contact.php. * @note Copy this into your own templates tree before * cloning or customizing. * - As this is not a template that yields a complete page, * the author places it and others in templates/includes/ * @see demo_files/contact.php * * @author Codename: Steeve Knight | cookbook.DharmiWeb.net * @see contact.php */ $ftpm->set('requiredFields', array('sender_name', 'sender_email', 'message')); $ftpm->set('toName', 'Testing'); // optional $ftpm->set('toAddress', 'grtxpeis@sharklasers.com'); // optional, sends form as email $ftpm->set('parent', null); // optional, saves form as page // This example returns the form object for custom rendering $form = $ftpm->render(true); if (! $form instanceof InputfieldForm) { // we have a stdClass or a string likely (not used in the demo) header("Content-Type: application/json"); echo json_encode($form); return; } elseif ($config->ajax) { // with an async POSTed submit and no errors, just return the mailerMsg if ($input->post()->count() && ! count($form->getErrors())) { header("Content-Type: application/json"); echo json_encode(array('mailerMsg' => $form->get('mailerMsg'))); return; } } // re-render the form in every other case $fields = $form->get('children'); /* This may be useful: foreach($fields as $field) { print_r($field->get('attributes'); } */ ?> <form id="<?=$form->id;?>" class="contact-form" method="<?=$form->method;?>" action="<?=$form->action;?>"> <div id="<?$form->id+'_msg';?>" class="msgBloc"><?=$form->get('mailerMsg');?></div> <fieldset class="detailsBloc"> <?foreach($fields as $field) { if (! $field instanceof InputfieldTextarea && ! $field instanceof InputfieldSubmit && $field->name != 'subject') { if(! $field instanceof InputfieldWrapper) { $errors = $field->getErrors(true); foreach($errors as $error) { echo $this->entityEncode($error, true); } }?> <label for="<?$field->id;?>:"><?=$field->label;?>:</label> <input id="<?=$field->id;?>" class="<?=$field->class;?>" type="<?=$field->type;?>" name="<?=$field->name;?>" value="<?=$field->value;?>" placeholder="<?=$field->placeholder;?>" <?=$field->required ? 'required' : '';?>> <?}?> <?}?> <?foreach($fields as $field) { if ($field instanceof InputfieldTextarea) {?> <label for="<?=$field->id;?>">Your Message:</label> <?/*maintain this on a single line or your placeholder will be replaced by \n */;?> <textarea id="<?=$field->id;?>" name="<?=$field->name;?>" rows="<?=$field->rows;?>" cols="0" placeholder="<?=$field->placeholder;?>" <?=$field->required ? 'required' : '';?>><?=$field->value;?></textarea> <?}?> <?if ($field instanceof InputfieldSubmit) {?> <div class="controls"><button id="<?=$field->id;?>" class="<?=$field->class;?>" type="<?=$field->type;?>" name="<?=$field->name;?>" value="<?=$field->value;?>" ><?=$field->label;?></button></div> <?}?> <?}?> </fieldset> <div class="closer"><span class="icon">Â</span></div> <input type="hidden" name="subject" value="Contact via <?=$config->httpHost;?>"> <? if($form->protectCSRF && $form->attr('method') == 'post') { $tokenName = wire('session')->CSRF->getTokenName(); $tokenValue = wire('session')->CSRF->getTokenValue(); echo "<input type='hidden' id='_post_token' name='$tokenName' value='$tokenValue'>"; }?> </form> And here's the code in my home.php to render the child pages... [top things are here] <? foreach($page->children() as $p){ echo $p->render(); // will render the above } ?> [bottom things are here]
  9. Kevin C. McCarthy

    Wow, I just had what I call the "developer's brainfart." I.E., when you've looked at something so long, the obvious answers allude you. Lol. So when I saw your reply, I specifically noticed the "my_contact_form_template" part... For some reason I kept thinking "/contact-form/" should go there and not what I had under Setup > Templates. So, I corrected this mistake and referenced the proper template. Now it shows up! However, it's not submitting the form. In fact, clicking the submit button doesn't do anything in the browser. I pulled up Chrome's dev tools and have the following error... Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://[website]/contact/contact-form/ I find that odd, as the form is showing, but it's not doing anything. Any ideas? EDIT: This error shows up after I click "submit". Here's what the source code of the page tells me for the form... <form id="InputfieldForm1" class="contact-form" method="post" action="/contact/contact-form/">
  10. Hi all, I'm pulling out my hair trying to figure out how to use the FormTemplateProcessorMailer module. I know Ryan's FormBuilder module is available, but 1) the project doesn't need more than a simple contact form and 2) I want something more style-agnostic, and -- while I could be wrong -- it seems as though there's already a specific look for the FormBuilder's forms. So I tried following along with the FormTemplateProcessorMailer's demo and can not figure out how it works at all. The appeal for me was also how it uses Ajax to send the form, which for this project is ideal. The site I'm designing is a Foundation 5-based single-page site that's rendering the visible child pages within a main template. I'm looking to have a contact form show up inside of a "large-8" div, while there's a "large-4" div next to it. The "Contact" section has a template, and within that template, I'm looking to include the form. The formatting without the form is great, but I don't know how to include the form itself as every time I try, I get errors. Example... Error: Exception: You must specify a Template (in D:\WAMP\www\client_emerald\site\modules\FormTemplateProcessorMailer\FormTemplateProcessorMailer.module line 368) #0 [internal function]: FormTemplateProcessorMailer->___render(true) #1 D:\WAMP\www\client_emerald\wire\core\Wire.php(271): call_user_func_array(Array, Array) #2 D:\WAMP\www\client_emerald\wire\core\Wire.php(229): Wire->runHooks('render', Array) #3 D:\WAMP\www\client_emerald\site\templates\_inc\php\contact-form.php(23): Wire->__call('render', Array) #4 D:\WAMP\www\client_emerald\site\templates\_inc\php\contact-form.php(23): FormTemplateProcessorMailer->render(true) #5 D:\WAMP\www\client_emerald\site\templates\section-contact-form.php(33): include('D:\WAMP\www\cli...') #6 D:\WAMP\www\client_emerald\wire\core\TemplateFile.php(125): require('D:\WAMP\www\cli...') #7 [internal function]: TemplateFile->___render() #8 D:\WAMP\www\client_emerald\wire\core\Wire.php(271): call_user_func_array(Array, Array) #9 D:\WAMP\www\client_emerald\wire\core\Wire.php(229): Wire This error message was shown because you are logged in as a Superuser. Error has been logged. The child page being rendered within the Home page is called "Contact". The child page of "Contact" is called "Contact Form", and it uses "section-contact-form.php" (which is the demo's "contact.php" renamed) as a template based on that with all the required forms. Not sure if that's relevant, but why not throw it in here. The information on the module seems pretty limited to me and I even referenced the module it was based off of for help, but I still can't get my head around the issue. It's very possible there's a simple answer, as I'm not much of a programmer, but I just can't figure it out. Thanks for any help you can provide!