Jump to content

AnotherAndrew

Members
  • Posts

    168
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by AnotherAndrew

  1. I'm using the latest version of PW 2.3. And I'm experiencing this problem with the module that you created for extra description fields for images.

    I'm using this same module in too other areas of my site with no problems at all. I did move from a local installation to the actual web server host and then tried to implement this third use of the module. But I don't think this should be a problem.

    I have also deleted the cache after moving. Isn't there any reasons to delete the session files?

    I'm pretty baffled.

  2. I'm having the exact same problem. 

    I have image fields in two other areas of a site that are behaving as expected. But when I use elsewhere the field data is not saving to the database. I have the same set up as my other areas. This is very perplexing. I don't even know where to begin debugging!

    I have debug on and no errors show. In the error log nothing is being displayed that is related. There are no javascript errors being reported. I am using a custom image field module. But like I said I am using it in other areas and it is functioning as intended.

    Anyone else experiencing this?!

  3. I'm developing a site for a client in a private directory on my web host that is running wordpress. In the clients site, I have a members section that requires a login. I'm having trouble with the logout url which when called will go to the wordpress logout screen when called. This is what I have for code:

    <div class="login-message">Hello <?php echo $page->title; ?>. Welcome back. <a class="logout" href="?logout=1">Logout?</a></div>
    
    

    I know that it will be fine in a live site but I need to show this functioning as intended for the client. Does anyone have any experience or suggestions on how to resolve this?

  4. I finally checked into this with my host and they claimed that I wasn't "closing the connections". Also apparently the account has enough SQL connections to support the traffic.

    I don't understand. I'm not experiencing this on other hosts.

    The only way I'm aware if this problem is through a service (binary canary) that tells me if the site is down. Could it be that their constant pings are pushing the connections over the limit?

  5. Apeisa, I have tried to installing this module but I am getting: 

    Notice: Undefined variable: fredi in ......./header.inc on line 31
     
    Fatal error: Call to a member function renderScript() on a non-object in ....../header.inc on line 31
     
    I have this before the close of the head tag:     <?php echo $fredi->renderScript(); ?>
     
    I can't seem to figure out what I am doing wrong. Thoughts?
  6. Hi and welcome to the forums. I'm currently experience a similar problem and I think I know the reason why.

    You are experiencing too many people hitting your site and there are not enough allowed MySQL connections by your web server host.

    If you are able to access your cpanel on your host, go there and check how many allowable connections you have available. Also if you have google analytics installed on your site you can see how many visitors on average are trying to view your site.

    In short you might need too up the amount of allowed MySQL connections can be made to your site. Many hosts will allow an unlimited amount. If your host doesn't either pay for more or consider moving to a different host that allows for an unlimited amount.

    Hope this helps.

  7. My site suddenly went down. I haven't changed anything in days. I'm getting this message:

    Fatal error: Exception: DB connect error 1040 - Too many connections (in /home/vg005web07/01/12/1031201/web/wire/core/ProcessWire.php line 96) #0 /home/vg005web07/01/12/1031201/web/wire/core/ProcessWire.php(46): ProcessWire->load(Object(Config)) #1 /home/vg005web07/01/12/1031201/web/index.php(166): ProcessWire->__construct(Object(Config)) #2 {main} in /home/vg005web07/01/12/1031201/web/index.php on line 203

    Does anyone know what this means?

  8. 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('');
    		}
    	});
    }
    });
    
    • Like 3
  9. onjegolders, thanks! That was exactly what I was looking for. And it ended up being pretty easy. I'm finally starting to understand php and pw.

    I agree with you pwired. This does seem to be a frequently requested topic in the forums. 

    Someone mentioned starting a repository of code snippets. Perhaps this could belong in there too.

  10. Mamp and lamp local installs can be tricky. I use Mamp and have only found it to work for processwire by setting full permissions on the entire PW directory. Yes I know this is not ok in a live setting but I switch permissions when I go to a live server. Maybe you should try an install on an actual web host.

    Sorry I can't be more of a help for a local install. Maybe someone else on the forums can help. I'm not the best developer around here!

×
×
  • Create New...