PHP - Change Page Content?
Currently, in my files, I echo content through either a function called error() or a funtion called info().
Each function has 3 require statements for the header, body and footer files and that is all that is contained in the function. What I want to do is, if error() is called, is kind of leave the script and exit it. Surprisingly I have used exit; at the end of the functions to stop any more of the script being executed. Is this the best way of doing it? Similar TutorialsHello friends,
I am trying to achieve a simple thing, but I do not know jquery/javascript much. When I click on a forst list item in one div , I want to show corresponding 1st li in the second div. I have 6 list items in total and related 6 li in second div.
Also when I click on any list item in first div, it will be borderd, this I achieved. But I am not able to bring the related li in the second div.
Hope I make myself clear.
Here is my code
<style> .selected img { border:2px solid #090; } .visible { display:block; } .invisible { display:none; } </style> <div id="all"> <ul> <li class="selected"><img src="image1.JPG" /></li> <li><img src="image2.JPG" /><br /></li> <li><img src="image3.JPG" /><br /></li> </ul> </div> <div class="container"> <ul> <li class="visible"><img src="related_image1.JPG" /></li> (In these list items there may be img or content) <li class="invisible"><img src="related_image2.JPG" /></li> <li class="invisible"><img src="related_image3.JPG" /></li> </ul> </div> <script type="text/javascript"> $('#all ul li').on('click', function(){ $(this).addClass('selected').siblings().removeClass('selected'); $('.container ul li:nth-child(1)').fadeout(); // Don't know this line is correct or not }); </script>Any help guys ? Edited by Jaswinder, 19 July 2014 - 08:57 PM. Hi, I have some files stored in mysql db. I have created a web page which shows the list of tutorials from db. at first i was creating a separate php page for each tutorial, but later i have decided that it would be easier and simpler if i can create one php page and whenever i click the tutorials it will change the content of this page. example: when i click "tut002" from list. it will change the content of tutorials.php . I have these tutorials in .html format here is the code i have in turorials.php once again, whenever i click a tutorial this include part needs to change automatically to whatever i click Code: [Select] echo '<div class="content">'; include ("inc/tut001.html"); echo '</div>'; it will be really appreciated if you have a sample code for this. sorry for my english. thank to whoever interested in this matter. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=319719.0 About a year ago I wrote a mod_rewrite in at sites htaccess file. It was to call a page that queried the database based on a unite code that was assigned to a member. If the member was assigned a code that was FL1001, the URL www.marketingteammates.com/FL1001 would bring up a page that quaried that member and displayed their database content.
In the users table of the site, it quaried the field webPageID and the information was called. It called a page webpage.php that quaried the info. The URL in the address bar still displayed www.marketingteammates.com/FL1001. Here are the lines of code in the htaccess file.
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z])([A-Za-z])([0-9]+)$ /webpage.php?webPageID=$1$2$3 [NC,L]I now have a second page completely different from the webpage.php. It is a page storeNumber.php and would query a field storeNumberID. This field could contain any kind of string such as Store#101, or mystore101, or #101 is my store. I tried using the same rewite rule just replaceing the webpage.php and variable with storeNumber.php and $storeNumberID. This doesn't work. It also leads me to wonder if there can even be two different pages in the mod_rewrite. How would it diferentiate one from the other. Thanks for any help in advance. Mike Hi every one I want to share a page content(or an article) into my facebook page via php . How should I do that ? Thanks Hello. I am attempting to display content from a database to a web page. I have SELECT * etc to do this, plus the menu that should be displayed has links to pages. This would display text to the page depending on the link, for this to work I use the id of the page ($Get['id']). Following advice (not code), I have attempted the following:
<!DOCTYPE html> <html> <?php include 'includes/headsection.php'; ?> <body> <?php // query database if (!empty($_GET['id']) && (intval($_GET['id']) == $_GET['id'])) { $pdo_statement = $conn->prepare("SELECT * FROM pages WHERE id=:id ORDER BY id ASC"); $pdo_statement->execute(['id' => $_GET['id']]); $result = $pdo_statement->fetchAll(); } ?> <!-- topMenu --> <table id="topMenu"> <tr> <td><h1 class="siteName">Site name</h1></td> <td> <?php if(!empty($result)) { foreach($result as $row) { ?> <a href="index.php?id=<?php echo $row['id']; ?>"><?php echo $row['menuheader']; ?></a> <?php } } ?> </td> </tr> </table> This issue is that the top menu (home, etc), does not appear, and there are no errors to suggest what I have done wrong. Any help will be appreciated. I include a picture of what I mean. There should be Home | other | etc...
I have a php page in which javascript called like this <script language="JavaScript" type="text/javascript" src="http://www.test.com/test.php"></script> the output of the page shows a well detail table , but when i use file_get_content method to get that all detail in a varaible its just took above javascript like $a=<script language="JavaScript" type="text/javascript" src="http://www.test.com/test.php"></script> when i right click on page to view source it show just <script language="JavaScript" type="text/javascript" src="http://www.test.com/test.php"></script>. But on actual page there is a html table which detail i have to store in table, Can any one tell me method. Every other time a user/users click on a link I want the link to change to a different url the next time a user clicks onto that link.
For example two links
url1.html
url2.html
url1.html shows up when a user clicks that link the link auto changes to then when a new user clicks the linke url2.html then back to url1.html and so on?
Don't know where to start on how I would do this let alone have the server remember to keep which ever link to be held for the next user?
/*i have some pages and i want to user to see an appropriate title when user click new page example: at home page on the tab the title must be written as welcome at hendra|home and when user clicked on about page, the tab must show another title like this you are at hendra|about page how to do this in php*/ //head <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title><?php echo $title; ?></title> </head><!--/end of head--> <body> //index page <?php include_once('head.php'); $title = 'welcome at hendra|home'; ?> //about page <?php include_once('head.php'); $title = 'you are at hendra|about page'; ?>
Most of the websites I have built have not been large and not dynamic in nature, but I need to make one now with a boatload of content on it. and I’m needing a little resource help where I can research something. I’m sure all developers do this, and I know I need a massive database or 2 and the PHP knowledge I already have, but I’m just looking for a little guidance about how to do this the easiest way. It may actually sound like a stupid question and I might be over-thinking a bit. So… Lets say I have 500 articles that I want to make available to a site visitor and give them the option to choose what they want to look at through nav menus and submenus. I want the same page to display to the user, regardless of what article is chosen. how does PHP play a part in that? Would I be right by saying the following? If the home page had this content on it: This website is a course in PHP coding. <a href="courseTemplate.php" target="_blank">Click here</a> to view course #1. and I wanted all the course content to be displayed through the use of the “courseTemplate.php” file, how simple is that? I would assume that these types of things would be the results and the techniques to accomplish the goal, right? => a resulting URL that looks like this: www.site.com/courseTemplate.php?id=1 => storing all the text of the course material in one single field of a DB record. NOT storing the layout-oriented code (HTML, etc.) and echoing it out with the rest of the text. => making use of the GET() function somehow to pull the course’s text content out of the database. Can someone show me a website that demonstrates this? I don’t think this is very difficult, and I’m sure there are web resources available that show how this is done. I’m almost sure that most news agency websites do this, and I know for a fact that most forum software has this template technique written into it, regardless if SEO is included or not. Sorry for the basic nature of this question. I know some of my previous posts have been such where I’ve asked much more difficult questions than this. I have seen youtube tutorials on issues similar to this, but nothing pulled up by google really shows this in a very simplistic nature. thanks. http://buildmyweb.org/testing/starter/
at the link above, you can see a test-page. the problem im having is that the content in the footer gets cutoff on the right side of the footer when viewed in an ipad. id love to hear it if anyone can figure out why
here is the html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="keywords" content = "Under Construction" /> <meta name="description" content="is currently Under Construction." /> <title>Under Construction</title> <link rel="stylesheet" type="text/css" href="bmw_footer_abs.css" /> </head> <body id="page_home"> <div id="wrapper"> <div id="banner"> </div> <!-- close banner --> <div id="main"> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </div> <!-- close main --> </div> <!-- close wrapper --> <div id="footer"> <div id="footer_content"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> <!-- close footer_content --> </div> <!-- close footer --> </body> </html>and the css: html { position: relative; min-height: 100%; } body { margin: 0 0 100px; /* bottom = footer height */ } #footer { position: absolute; left: 0; bottom: 0; height: 100px; width: 100%; min-width:1000px; background:gray; } #wrapper { position:relative; top:0px; margin:0 auto; width:1000px; text-align:left; background:pink; padding:0px; } /* **************** BANNER *************** */ #banner { float:left; background:green; width:100%; height:10px; } /* **************** MAIN *************** */ #main { float:left; width:100%; background-color:#f0f3f8; } /* **************** FOOTER *************** */ #footer { font-size:85%; line-height:1.3; } #footer_content { width:1000px; margin:0px auto; background:orange; } I'm doing a cURL post to a server and it returns "true No_Error Data was accepted 10356546 3770 false 0 " Form --> Method=Post --> submit.php (this is the page that's doing the cURL post and the server returns data that appears on this page). How do I take this and put it into a string? Good day everyone! I know this is possible but I do not know how to do it. I have a single page, this page has no dynamic content. I have a set of links. What I need is to have content placed on the page based on the link the user clicks. Example: I have pictures of animals. When the user click a Zebra, the Zebra info is placed on the page. So the page does not change, meaning the content on the page changes but not the page it self. The idea is instead of creating different html pages for each animal profile, the profile is generated to the page from a php include file. Is is this possible? Can anyone, some one please point me to how I can get this going. Thanks everyone! IC What I'm trying to do is get a php file with content to load into my basic page template based on the page id, however it's not loading anything, however there are no errors coming up. I've looked everywhere I could find, and tried everything I could think of. I really could use some help on this. Below is the page template code and the code I'm trying to use to get the content to load up. page_templ.php Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > <link rel="stylesheet" type="text/css" href="templates/content/style.css" > <!--This is the css used for IE because we need to correct some things for it.--> <!--[if IE]> <style type="text/css"> @import 'templates/content/styleIE.css'; </style> <![endif]--> </head> <body> <?php //We need to load our language files with our common text varibles require("content/langeng.php"); ?> <div id="header"> <? //Lets show the header. I use html where I can so smartphones load as little advanced code as possible require_once("header.php"); ?> </div> <div id="menu"> <?//Now our menu. require_once("menu.php"); ?> </div> <div id="mbody"> <?//Now the primary site content. //Load up our postvars.php file require_once("content/postvars.php"); ?> </div> </body> </html> postvars.php Code: [Select] <?php $id = $_POST["id"]; if ( $id == "home" ) { include 'main_c.php'; } elseif ( $id == "guides" ) { include 'guides_c.php'; } elseif ( $id == "trips" ) { include 'trips_c.php'; } ?> Hi everyone, newbie to site looking for help with my tag/category page formatting.
I recently bought a plugin for masonry and have been trying to make it the display for posts on my blog pages as you can see he http://www.enduringepilepsy.com/_blog/ and http://www.enduringe...m/archive/_2013
It's been helping my design and page load overall (Note: I do use Google Page Speed Service)
But I cannot figure out how to be able to use this customizable masonry for my tag/category pages since they do no show the ability to edit on the Wordpress admin bar.
I've looked at the php code in my files, and while I have become more familiar with php in the yr since I moved to Wordpress, am unsure how to edit these pages without making a mess.
The plugin is http://codecanyon.ne...-plugin/7563340 My theme, called Inzin, is no longer sold, and the developer disappeared from online. So I have lost all support. I would really appreciate any help anyone could offer. Thank you!
This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357949.0 Hello! I have my own framework through which all modules are loaded and content is stored in specific class. At the end all the content is displayed on screen. I'm stucked at this last step when I want with php function (print or echo) to display the contents of all pages on screen. Then the server obviously can't handle this, because after a few clicks page hangs (stops responding - until I close the browser and reopen the page). Maybe are there some restrictions on server? Page is loading on other server just fine (that other server is a little bit faster). it' online shop with lots of html code (that's the only difference between pages that works and this one that hangs!) Any ideas? Hi there, I have updated a webpage and it appears that some users are still seeing the older version of the page. Is there a way I can force the user's version of the page to display the latest content on the page? I have see I can add some meta tags which control the cache, but my site relies quite heavily on cookies, so I guess clearing the cache would reset/have an effect on the cookies? Does anyone have any ideas on how I can make users always see the latest content? Thanks! Hello! I would like to use cURL to login to the website: lockerz.com I have some code, but it doesn't seem to work: <?php // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, 'http://lockerz.com/auth/login'); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, 'email-email=EMAIL@hotmail.com&password-password=PASSWPRD'); // IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); # Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL # not to print out the results of its query. # Instead, it will return the results as a string return value # from curl_exec() instead of the usual true/false. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST (FORM LOGIN) $store = curl_exec ($ch); // SET FILE TO DOWNLOAD curl_setopt($ch, CURLOPT_URL, 'http://lockerz.com/auction'); // EXECUTE 2nd REQUEST (FILE DOWNLOAD) $content = curl_exec ($ch); // CLOSE CURL curl_close ($ch); echo $content; ?> Thank you very much if you can help! Hi, I've done some serious google'ing... I'm all googled out and it doesn't appear there is a solution to this the way I'm attempting it and it's probably more a case of my early ventures into development that I'm missing something that may or may not be a better and if not more obvious way to do this... Here's the principle, Customer Logs into webpage - greeted by profile page (all cushty so far) - Can choose to move to view 'audio files' which relate to the products they have purchased (this is where it gets silly...) The idea is that both the profile page and the audio page are controlled by a $_SESSION within PHP scripting so the pages are dynamic. I want to include all of the audio files for every product on the 'audio.php' page BUT I only want the ones that they have purchased to be visible... All the setup is fine because the following works fine: Code: [Select] if($info['halftimerock'] == 1) { echo "<p>Half Time Rock</p>";} Which essentially checks the db, finds a 1 in the appropriate product and displays the name of the product in a list, if no products then nothing in the list etc. What I want to do is control the visibility of some <div>'s using the same kind of idea, so: Code: [Select] if($info['halftimerock'] == 1) { CODE TO DISPLAY DIV IN HERE } I have a 'toggleelement' JS function available which works for mouse clicks but obviously php and js don't exactly go well together so that is probably not the way to go, I'm already running a lot of PHP at the top of the page before the HTML to stop session header errors. A couple of web searches have suggested I insert a <script> tag into the echo command but I can't get that to work and I guess it's a really messy way of trying to do things! So here's the question, any ideas about how to toggle <div> visibility within php or is that purely something for js to handle?... Is there a better/cleaner way of doing it all, perhaps redirecting users to different pages based on their entries in the DB (which could all be handled with headers but I'll end up with a million different pages and combinations eventually? I could always create a .htaccess/.htpasswd file system and handle the folders with audio content in manually so that all files are visible but only a valid username and password will be able to access the file but that's going to get annoying for people having to put in user/pass for every file and also for me updating the users for each individual file every time some1 buys something... Any ideas? Anybody done anything similar? Cheers |