Jump to content


AnotherAndrew

Member Since 21 Nov 2011
Offline Last Active May 21 2013 01:00 PM
-----

#34175 Useful jquery plugins snippet site

Posted by AnotherAndrew on 03 May 2013 - 06:39 PM

Check it out this page with useful jquery plugins. Might help you!




#33184 Fredi - friendly frontend editing

Posted by AnotherAndrew on 17 April 2013 - 11:31 AM

Ahh no. I was calling it afterwards. Thanks diogo!




#32823 Fredi - friendly frontend editing

Posted by AnotherAndrew on 12 April 2013 - 08:00 PM

apeisa, you are my hero! A client was looking for this option just today. I will try it out and thanks for all your hard work!




#31397 One page website contact form with jquery validation?

Posted by AnotherAndrew on 29 March 2013 - 09:24 AM

Here use this:

 

<?php

$sent = false;
$error = '';
$emailTo = 'YOUR EMAIL ADDRESS'; // or pull from PW page field

// sanitize form values or create empty
$form = array(
    'fullname' => $sanitizer->text($input->post->fullname),
    'email' => $sanitizer->email($input->post->email),
    'comments' => $sanitizer->textarea($input->post->comments),
    ); 

// check if the form was submitted
if($input->post->submit) {
        
    // determine if any fields were ommitted or didn't validate
    foreach($form as $key => $value) {
        if(empty($value)) $error = "<p class='error'>Please check that you have completed all fields.</p>";
    }

    // if no errors, email the form results
    if(!$error) {
        $msg = "Full name: $form[fullname]\n" . 
               "Email: $form[email]\n" . 
               "Comments: $form[comments]"; 

        mail($emailTo, "Website contact form submission", "$form[comments]", "From: $form[email]");

        // populate body with success message, or pull it from another PW field
        $page->body = "<div id='message-success'><p>Thanks, your message has been sent.</p></div>"; 
        $sent = true;   
    }
}

if(!$sent) {

    // sanitize values for placement in markup
    foreach($form as $key => $value) {
        $form[$key] = htmlentities($value, ENT_QUOTES, "UTF-8"); 
    }

    // append form to body copy
    $page->body .= <<< _OUT
    	$error
        <form action="./" method="post" id="contact-form">
			<fieldset>
				<legend>Send a note</legend>
					<ol>
						<li class="form-row">
							<span class="error" style="display: none;" ></span>
						</li>
						<li class="form-row">
							<input id="fullname" name="fullname" type="text" size="30" class="name required default" title="Your name" value="$form[fullname]"/>
						</li>
						<li class="form-row">
							<input id="inputemail" name="email" type="text" size="30" class="required email default" title="Your email address" value="$form[email]" />
						</li>
						<li class="form-row">
							<textarea name='comments' rows='5' cols='45' id='comments' title="Your message">$form[comments]</textarea>
						</li>
						<li class="form-row">
							<input type="submit" name="submit" value="Send" class="submit-button"/>
						</li>
					</ol>
			</fieldset>
        </form>

_OUT;

}
?><?php 

/**
 * Contact form template
 *
 */

include("./header.inc"); 
?>
        <div class="main-container">
            <div class="main wrapper clearfix">
                <article>
                    <section>
	                    <?php echo $page->body; ?>
                    </section>
                </article>
            </div> <!-- #main -->
        </div> <!-- #main-container -->
<?
include("./footer.inc"); 


Oops and here is the jquery for validation:

$(document).ready(function() {
	$(".default").each(function(){
		var defaultVal = $(this).attr('title');
		$(this).focus(function(){
			if ($(this).val() == defaultVal){
				$(this).removeClass('active').val('');
			}
		});
		$(this).blur(function() {
			if ($(this).val() == ''){
				$(this).addClass('active').val(defaultVal);
			}
		})
		.blur().addClass('active');
	});
	$('.submit-button').click(function(e){
		var $formId = $(this).parents('form');
		var formAction = $formId.attr('action');
		defaulttextRemove();
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		$('li',$formId).removeClass('contact-form-error');
		$('span.contact-form-error').remove();
		$('.required',$formId).each(function(){
			var inputVal = $(this).val();
			var $parentTag = $(this).parent();
			if(inputVal == ''){
				$parentTag.addClass('contact-form-error').append('<span class="contact-form-error">Required field</span>');
			}
			if($(this).hasClass('email') == true){
				if(!emailReg.test(inputVal)){
					$parentTag.addClass('contact-form-error').append('<span class="contact-form-error">Enter a valid email address.</span>');
				}
			}
		});
		if ($('span.contact-form-error').length == "0") {
			$formId.append($loading.clone());
			$('fieldset',$formId).hide();
			$.post(formAction, $formId.serialize(),function(data){
				$('.loading').remove();
               $formId.append(data).fadeIn();
        	});
		}
		e.preventDefault();
	});

function defaulttextRemove(){
	$('.default').each(function(){
		var defaultVal = $(this).attr('title');
		if ($(this).val() == defaultVal){
			$(this).val('');
		}
	});
}
});



#31258 "Skeleton" Version of PW

Posted by AnotherAndrew on 27 March 2013 - 07:33 PM

Have you looked in the modules download area for site profiles? I haven't used it but maybe you are after something like what Soma submitted.




#30683 Module: CKEditor

Posted by AnotherAndrew on 20 March 2013 - 03:04 PM

Here's how to add your own styles in case someone is wondering. Before doing so, you need to add it into your text field under input, cke editor settings, cke toolbar, and add "Styles". Then you can modify styles.js under "inputfieldCKEditor/ckeditor-4.1.0/styles.js".

 

Pretty cool. You can add block styling and inline styling. Though the block styling could cause problems with site layout and look if you are not careful.




#30536 Contact form

Posted by AnotherAndrew on 19 March 2013 - 03:33 PM

I just realized that my contact form is not working since updating to the latest version of PW.

 

I gleaned the following code from the PW forums over a year ago. But I am a noob to php and can't seem to find what could be wrong with the code. Does anyone see anything obvious?

 

<?php

$sent = false;
$error = 'user@example.com';
$emailTo = 'user.bill@example.com'; // or pull from PW page field

// sanitize form values or create empty
$form = array(
    'fullname' => $sanitizer->text($input->post->fullname),
    'email' => $sanitizer->email($input->post->email),
    'comments' => $sanitizer->textarea($input->post->comments),
    ); 

// check if the form was submitted
if($input->post->submit) {
        
    // determine if any fields were ommitted or didn't validate
    foreach($form as $key => $value) {
        if(empty($value)) $error = "<p class='error'>Please check that you have completed all fields.</p>";
    }

    // if no errors, email the form results
    if(!$error) {
        $msg = "Full name: $form[fullname]\n" . 
               "Email: $form[email]\n" . 
               "Comments: $form[comments]"; 

        mail($emailTo, "Website contact form submission", "$form[comments]", "From: $form[email]");

        // populate body with success message, or pull it from another PW field
        $page->body = "<div id='message-success'><p>Thanks, your message has been sent.</p></div>"; 
        $sent = true;   
    }
}

if(!$sent) {

    // sanitize values for placement in markup
    foreach($form as $key => $value) {
        $form[$key] = htmlentities($value, ENT_QUOTES, "UTF-8"); 
    }

    // append form to body copy
    $page->body .= <<< _OUT

        <form action="./" method="post" id="contact-form">
			<fieldset>
				<legend>Send a note</legend>
					<ol>
						<li class="form-row">
							<span class="error" style="display: none;" ></span>
						</li>
						<li class="form-row">
							<label for="fullname">Name</label>
							<input id="fullname" name="fullname" type="text" size="30" class="name required default" title="Your name" value="$form[fullname]"/>
						</li>
						<li class="form-row">
							<label for="email">Email</label>
							<input id="inputemail" name="email" type="text" size="30" class="required email default" title="Your email address" value="$form[email]" />
						</li>
						<li class="form-row">
							<label for="comments">Message</label>
							<textarea name='comments' rows='5' cols='45' id='comments' title="Your message">$form[comments]</textarea>
						</li>
						<li class="form-row">
							<input type="submit" name="submit" value="Send" class="submit-button"/>
						</li>
					</ol>
			</fieldset>
        </form>

_OUT;

}
?><?php 

/**
 * Contact form template
 *
 */

include("./header.inc"); 
?>
        <div class="main-container">
            <div class="main wrapper clearfix">
                <article>
                    <section>
	                    <?php echo $page->body; ?>
                    </section>
                </article>
            </div> <!-- #main -->
        </div> <!-- #main-container -->

<?
include("./footer.inc"); 

 

 




#22148 Configuring Wordpress Plugins [PHP files] as modules

Posted by AnotherAndrew on 11 December 2012 - 08:08 PM

JJS, I think what others are trying to say is that you can't take the code from Wordpress plugins and easily integrate it into PW. If you want to use PW then you need to use PW framework and forget about Wordpress. Wordpress' PHP does not work with PW. They are two completely different systems.

There are some PW modules created by the community that will work with what you are desiring, like putting the site into maintenance mode or language translations or tagging. But for other features, like a members only section, you are going to have to dig into the forums and learn how others have implemented into their sites.

Just ask very specific questions and you will get the answers. Break your project down into what you need and ask away!


#18325 Forms driving you crazy? Something I'm developing ...

Posted by AnotherAndrew on 11 October 2012 - 03:35 PM

Martijn Geerts:

I knew I might stir up the bees nest. I'm not dissing on Ryan's work at all and saying that it is not appreciated.

Perhaps we should have a donation option for those that would like to support PW. I would love to support Ryan's work and expenses, even supporting the hosting for this site and the forums. I think that would be a better gesture of support than by buying code.


#18319 Forms driving you crazy? Something I'm developing ...

Posted by AnotherAndrew on 11 October 2012 - 02:37 PM

Thanks Clinton! That looks like a promising start. Please do keep us up to date.

I know Ryan has kicked out a form builder module (and its sweet!), but he has stuck a price tag on it. I realize that he has spent a lot of time on it, but I would prefer if PW was just users helping one another out and not trying to turn a profit. So thanks for taking a stab at this!!


#12698 Blog Profile

Posted by AnotherAndrew on 13 June 2012 - 04:00 PM

Diogo beat me to it. But I will reiterate one of his comments

A settings page. A place where people can change the color of the titles and links from blue to whatever they want, and also the typeface maybe. I would keep the customization to a minimum, though. This would imply having some dynamic style, and could make it more difficult for a "zen garden" kind of thing, of course.


I think this is what make wordpress so attractive for many people who can't code. They can download a wordpress theme and if it supports customization then they can easily change out header images, fonts, text color.


#12558 Repeater field bug?

Posted by AnotherAndrew on 09 June 2012 - 02:40 PM

WillyC, you the man. That worked like a charm. I forgot to say "misjgoth" but it still worked!


#10535 Mobile version of website

Posted by AnotherAndrew on 11 April 2012 - 07:49 PM

I used media queries to make a PW site responsive, at least for the iPhone. Pretty easy and fun to do. Check it out either on a mobile or simply rescale your browser. It was fun to set up and easy to do.

http://www.eastsidenurseryschool.org

The only thing I am not fond of is my treatment of the sub navigation menu on some pages. If anyone has suggestions I would love to hear them!


#9067 Preschool Site

Posted by AnotherAndrew on 09 March 2012 - 02:46 PM

Hey all. I just put up another site using PW. Thanks everyone for helping me get started using PW!

Check it out here: http://www.eastsidenurseryschool.org/

What do you think?


#7907 Automatic backup

Posted by AnotherAndrew on 08 February 2012 - 08:46 PM

Building off of this discussion, it would be extremely helpful if there was automatic backup of db files AND site template files, either via a module or built into processwire. Backups could be scheduled and work in the background.

The wordpress plugin BackWPup is superb at this. A user can automatically backup to several different places: the current server, another server, dropbox, by email, amazon services, etc.