Search the Community
Showing results for tags 'page'.
-
I am trying to include a file from another directory and so far I keep getting errors such as "failed to open stream: No such file or directory in...". Here's my directory setup. home/ /template/header.php /members/private/settings.php All I want to do is include "header.php" file on my "settings.php" page. Here's an example. settings.php <?php $dir = dirname(__FILE__); require_once $dir.'/template/header.php'; Can you tell me what's wrong with it? It's not working.
-
I would like to know how can I redirect a jquery dialog function to a different page, if another function is true? For eg. 1. User 1 sends a request to User 2. 2. User 2 accepts the request. 3. User 1 still has the request "dialog" window open. Instead, I would like to have that dialog window close and redirect to a specified page. Of course this only happens after User 2 accepts the request and I check against it in the database. Here is the function for when User 1 makes a request. <script> $(function() { $("#new-dialog").dialog({ resizable: true, autoOpen: false, modal: true, width: 600, height: 300, buttons: { "Cancel Trade": function(e) { $(this).dialog("close"); $.ajax({ type:"post", url:"request-trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>", data:"action=cancelTrade", success:function(data){ if(data == true) { alert('success'); } else { alert('not deleted'); } //window.location.href='trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>'; } }); } } }); $(".dialogify").on("click", function(e) { e.preventDefault(); $("#new-dialog").html(""); $("#new-dialog").dialog("option", "title", "Loading...").dialog("open"); $("#new-dialog").load(this.href, function() { $(this).dialog("option", "title", $(this).find("h1").text()); $(this).find("h1").remove(); }); }); }); </script> And here is the new function in which I check the database for match. If it returns true, I would like to redirect the above dialog/page. <script> $('document').ready(function(){ function checkTrade() { $.ajax({ type:"post", url:"request-trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>", data:"action=checkTrade", success:function(data){ window.location.href='trade?by=<?php echo $session_requestById; ?>&to=<?php echo $session_requestToId; ?>'; } }); } }); </script> So what am I missing to do the redirect?
-
- php
- javascript
-
(and 3 more)
Tagged with:
-
I'm trying to learn how to create a single page layout, I've tried to mimic other layouts just from looking at them, but I don't know how to style it properly so it works smoothly. I think I've made a huge boo-boo http://gamer-cafe.net/juliesjungle/index.html#About
-
<script> $('.add_to').click(function(){ //alert(1); productId= $(this).attr('id'); //var grandTotal= $('#grandTotal').html(''); $('#sucessAdd').html('<img src="images/ajax-loader.gif" align="center" />'); //var grandTotalfloat= parseFloat(grandTotal); $.ajax({ type: "POST", url:"pass.php", data: {action:'addCatalog',productId:productId}, success:function(result){ //alert(result) if(result==1){//add_to_cat $('#'+productId).remove(); $('#'+productId).fadeTo("fast", .5); $('#sucessAdd').html(''); //$('#sucessAdd').css('color','green'); $('#sucessAdd').addClass('add-sucess'); $('#sucessAdd_'+productId).html('<font coloe="red"><b>Add Successfully</b></font>'); $("#"+productId).style.display="block"; } } }) }); </script> <div class="items_box_link"> <a href="#" id="<?php echo $productRow['id'];?>" class="add_to">ADD TO CART</a> </div> ..........................................////////////////////////////............................................ after add to cart, my page goes to top but i want it to remain dere only.. any help!.. thanks.
-
Say my goal is to have posts with user comments with each individual post. And these posts are posted in relavent catagories. This is all done. Works beautifully. Now say my 2nd goal is to use ajax for everytime a user posts a comment in a post, it'll load the comment without refreshing the page. This is where I am having an issue. So say this is my setup. index.php <a href="records.php?title=<?php echo $record_id; ?>"> records.php <head> script type="text/javascript"> $(document).ready(function(){ $(".comment_button").click(function() { var element = $(this); var test = $("#content").val(); var dataString = 'content='+ test; if(test=='') { alert("Please Enter Some Text"); } else { $.ajax({ type: "POST", url: "ajax.php", data: dataString, cache: false, success: function(data){ $('#display').html(data); document.getElementById('content').value=''; } }); } return false; }); }); </script> </head> <body> <form method="post" name="form" action=""> <textarea name="content" id="content" cols="45" rows="5"></textarea> <input type="submit" value="Update" id="v" name="submit" class="comment_button"/> </form> <div id="display" align="left"> <div> </body> ajax.php // need to get id of current post here. Of course this is not the complete code but you get the idea. The queries that insert and the get the records work. The only issue I have is that the 'get' query won't get the current post id. It makes sense since it's in ajax.php and it's processing through the ajax function. If that query was on records.php, yes it will work. So my question is, is there a way around it?
-
Hi, not sure if ive posted this in the right section, but im making a website thats mainly html but ive thrown some PHP for the contact us page, i have used a form that requires the user to send a message to an email, ive tested it and i get the message that ive set to show that its sucessfully sent, but when i check my email to see if it has sent well... it hasn't, im new to PHP but do i have to have the site online in order for the message to send?
-
Hi Guys, I have a website that has a homepage without a title bar but the rest of the pages in the site do have it. I want to apply this same bar to the homepage can anyone help. See below the 3 main pieces of code: This is the code for the Header <?php ?><!DOCTYPE html> <!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]--> <!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]--> <!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--><html <?php language_attributes(); ?>> <!--<![endif]--> <!-- head --> <head> <!-- meta --> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta http-equiv="X-UA-Compatible" content="IE=9" /> <?php if( mfn_opts_get('responsive') ) echo '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'; ?> <title><?php global $post; if( mfn_opts_get('mfn-seo') && is_object($post) && get_post_meta( get_the_ID(), 'mfn-meta-seo-title', true ) ){ echo stripslashes( get_post_meta( get_the_ID(), 'mfn-meta-seo-title', true ) ); } else { global $page, $paged; wp_title( '|', true, 'right' ); bloginfo( 'name' ); if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'bretheon' ), max( $paged, $page ) ); } ?></title> <!-- stylesheet --> <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" media="all" /> <?php do_action('wp_styles'); ?> <!-- wp_head() --> <link rel="shortcut icon" href="<?php mfn_opts_show('favicon-img',THEME_URI .'/images/favicon.ico'); ?>" type="image/x-icon" /> <?php if( is_single() ): ?> <script>var switchTo5x=true;</script> <script src="http://w.sharethis.com/button/buttons.js"></script> <script>stLight.options({publisher: "ur-6568e777-919c-a5dd-ac31-98a6fa2e6b2d"}); </script> <?php endif; ?> <?php do_action('wp_seo'); ?> <?php wp_head();?> </head> <!-- body --> <body <?php body_class(); ?>> <div id="Wrapper"> <?php get_template_part( 'includes/header', 'top-area' ); if( ! is_404() ){ $slider = false; if( get_post_type()=='page' ) $slider = get_post_meta( get_the_ID(), 'mfn-post-slider', true ); if( $slider ){ if( $slider == 'mfn-offer-slider' ){ // Mfn Offer Slider get_template_part( 'includes/header', 'offer-slider' ); } else { // Revolution Slider echo '<div id="mfn-rev-slider">'; putRevSlider( $slider ); echo '</div>'; } } elseif( trim( wp_title( '', false ) ) ){ // Page title echo '<div id="Subheader">'; echo '<div class="container">'; echo '<div class="sixteen columns">'; if( get_post_type()=='page' || is_single() ){ echo '<h1>'. $post->post_title .'</h1>'; } else { echo '<h1>'. trim( wp_title( '', false ) ) .'</h1>'; } mfn_breadcrumbs(); echo '</div>'; echo '</div>'; echo '</div>'; } } ?> This is the code for the Index page which is the homepage <?php get_header(); $sidebar = mfn_sidebar_classes(); ?> <!-- #Content --> <div id="Content"> <div class="container"> <!-- .content --> <?php if( $sidebar ) echo '<div class="content">'; echo '<div class="the_content the_content_wrapper">'; while ( have_posts() ) { the_post(); get_template_part( 'includes/content', get_post_type() ); } // pagination if(function_exists( 'mfn_pagination' )): mfn_pagination(); else: ?> <div class="nav-next"><?php next_posts_link(__('← Older Entries', 'bretheon')) ?></div> <div class="nav-previous"><?php previous_posts_link(__('Newer Entries →', 'bretheon')) ?></div> <?php endif; echo '</div>'; if( $sidebar ){ echo '</div>'; } else { echo '<div class="clearfix"></div>'; } ?> <!-- Sidebar --> <?php if( $sidebar ){ get_sidebar( 'blog' ); } ?> </div> </div> <?php get_footer(); ?> This is the code for the inner pages which contain the title bar <?php get_header(); $sidebar = mfn_sidebar_classes(); ?> <!-- Content --> <div id="Content"> <div class="container"> <!-- .content --> <?php if( $sidebar ) echo '<div class="content">'; while ( have_posts() ) { the_post(); get_template_part( 'includes/content', 'page' ); } if( $sidebar ){ echo '</div>'; } else { echo '<div class="clearfix"></div>'; } ?> <!-- Sidebar --> <?php if( $sidebar ){ get_sidebar(); } ?> </div> </div> <?php get_footer(); ?>
-
I have a website called gapagap.com developed using php. What is basically want is to change the url pattern from: http://www.gapagap.com/gag/54 To this: gapagap.com/gag/then-why-am-i-not-a-millionaire-yet So what I basically want is to add the post title in the end of the url instead of the post sequence number.
-
Hey Guys, I've got a pop up box showing the cookie warning (for the EU laws). I've got it in the corner of the screen and that's working fine but I want to centre it to the middle of the page. This is the code that I use to place the popup overlay top right, how can I change the css to make it centred? <style> #tpmask { background-color: #000000; z-index: 9999; display: block; position: absolute; left: 0; top: 0; opacity: 0.6; height: 100%; width: 100%; } #boxes .window { right:20px; top:20px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; width:auto; height:auto; display:none; z-index:9999; padding:20px; box-shadow: 0 0 18px rgba(0, 0, 0, 0.4); } #boxes #dialog { position: absolute; width: auto; margin: auto; max-width: 800px; height: auto; _width: 0; white-space: normal; overflow: visible; padding: 10px; font-family: 'Lucida Grande', Arial, 'Arial Unicode MS', Helvetica, sans-serif !important; color: #FFFFFF; font-size:13px !important; } #dialog a:link, a:visited, a:hover { color: #000000 } *html #boxes .window { position: absolute; } #boxes .window .close { background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: url('images/close.png'); background-origin: padding-box; background-position: 0% 0%; background-repeat: no-repeat; background-size: auto; height: 36px; right: -19px; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; position: absolute; top: -19px; width: 36px; } </style>