PHP include menu system - Reload not working - php

I have very simple page at the moment. The only thing that I using PHP for is a switch menu system. So in the switch system i check the variable "menu" to see what it's set to.
So for example if i load the contact info it would be
www.mydomain.com/?menu=contact
in the php switch code under "menu" there is only one thing.
include("contact.php");
Ok, I know this is very simple, but the problem that I am having is when i change the "contact.php" the changes won't be noticeable in the browser, not until i actually go directly to that file. So I would have to browse to www.mydomain.com/contact.php and then i see the difference. After doing that I can go back to "www.mydomain.com/menu?contact" and see the difference.
I have tried to reload, refresh and reload cache command in Firefox, Safari and Chrome. They all work the same way. How can I fix this, it's rather time consuming to refresh two pages each time I need to see the changes.

Are you using a caching system like eaccelerator or APC on your system (phpinfo(); would tell you).
What happens if you print the time() and filemtime() of the template before requiring it, it should tell you when it was last modified.

Related

Google Chrome won't update CSS

I just started working on a Wordpress theme, but it won't reload the stylesheet after I update. I searched throughout here and tried the common remedies, including:
Reload holding ctrl/shift
Reload while Developer Tools is open
Reload twice quickly in a row
Get firefox/firebug
Add the timestamp generator to the end of the href
Install an extension, specifically this one: https://chrome.google.com/webstore/detail/clear-cache/cppjkneekbjaeellbfkmgnhonkkjfpdn?utm_source=chrome-app-launcher-info-dialog\
It seems like it only reloads every once in a while, and it really impedes my ability to write CSS...
Does anyone here have any ideas to fix this?
Thanks.
edit: I think it may have something to do with my host (it's free). I'm just going to move offline for development, I think.
You can always go into Incognito which does not use any chached data. It also does not save any history information.
To use it you can press Crtl+Shift+N then navigate to the page / website that you want to see.
You can also access Incognito by pressing the ☰ icon in the top right of your chrome window and click on New incognito window:
If your page is still not updating I would make sure that the file is even being saved. Because at this point your issue would not be because of files being cached..
My only other thought is that it could be your CSS itself... Sometimes your CSS is not applied due to an error in your code, another piece of code counteracting it, etc...
So see what is being applied:
press F12
OR
right click somewhere on your page and press Inspect Element.
You should see something like this (except with your code / webpage):
The parts of the "Inspect Element" will be sized slightly different but you can change those around...
Essentially click on the html element that you are trying to change the css on...
You will now see what css elements are being displayed... If they are crossed out, it most likely means that there is some other parent (or just some other property) that is canceling out the css you are adding.
These are just some of the reasons why the CSS may not be working! But I hope this helps!
When working with child theme, make sure you are loading the right css file. Sometimes you load the parent's css file.
Make sure to disable cache plugin in development time.

Modx Wayfinder different context menu only shown after refresh

I'm trying to display the main menu from other context using Wayfinder. I have the following call:
[[!Wayfinder#MainMenu? &startId=`0` &contexts=`web` &scheme=`full`]]
The problem is that the first time the page is visited, no menu is displayed. After a refresh it shows up. This happens from time to time.
I'm guessing it's some kind of cache problem but I can't figure out why it doesn't show the first time round.
Setting cacheResults to true or false doesn't seem to affect the issue.
Any help?
Thanks
This answer might come in late but you should try manually deleting the contents of core > cache via ftp or ssh. That usually does the trick when I have issues like that.

What could be the cause when the HTML and PHP code already finish execute but page still loading?

I've created a HTML + PHP simple page with some javascript that provide from google like adsense and google plus button.
The thing is the page is very short. I meant like not much content on it and I'm curious that why when the page is fully loaded like everything appeared and nothing missing, but the bar on google chrome or like firefox is still loading?
I did test removed the javascript for ads and button and it still having the samething
Is this normal? or maybe something wrong in my code that I should look at?
Open the developers tools (Ctrl-Shift-I in Chrome), go to the network tab and load your page, you'll see exactly what component is taking what time.
Most clever add-ons / plugins like google+, Analytics, etc. load when your own content is completely loaded so you might see some action after the page is visually done.
Edit: The developers tools in Chrome can easily be reached from the menu as well...
Check out http://tools.pingdom.com/fpt/
It will let you know what is still loading.
If nothing pops out then your JavaScript is probably in an infinite loop.

PHP session_cache_limiter not working in Safari?

I've been trying to correctly manage sessions throughout the online ordering system I'm writing using PHP. I've got it functioning the way I intended and I allows users to hit the "back" button mid-process, without screwing up the database.
The only thing I do still want, is to prevent the "back" button being used on (or after) the final "All done" screen.
In step 3 (Confirm and proceed) and step 4 (All done), I've included the lines:
session_cache_limiter('nocache');
session_start();
This works perfectly in IE - you see the page confirming your order, but you get a warning if you try to hit "back". The same applies if you navigate on from the site - you can't see the final step.
The same site doesn't seem to work in Safari (5.1.2). I can hit "back" and see all the content that was displayed (it's getting it from a local cache, and not the server).
The site doesn't accept repeated input, so it's not a massive problem, but it's not the functionality I wanted. Does anyone know how to make this work in Safari?
I don't think the problem is the code, but the browser behaviour.
In Safari, when you press the back button, it just bring you to the same page you were before, just like you opened the new page in another tab and then closed it, even if you set the cache to ‘no-cache’. In Internet Explorer, on the contrary, when you press back, it takes you to the previous page by pointing to its url and loading it again.
Reading here and there, it seems that there's no way to avoid this behaviour, apart from a little trick, which should force the browser to reload the page when you press back: Preventing cache on back-button in Safari 5.

Lost sessionvariables in firefox

I have a pretty strage problem im dealing with.
Lost sessionvariables in firefox.
Im using wordpress and have a subpage that causes the loss.
More specific:
In wordpress there exists a page called My pages (Original page names are in swedish, translated for convinience)
Under this page i have a few subpages. Among these are a page called Create test. There is nothing special about this page, for now only contains the phrase "hello world". If I enter any page other that this, it works.
But this particular page just seems to clear my session variables (wich I use to store login info)
I tried deleting the page in question in the effort to remake it.
While it was deleted I tried navigating around on the page.
Create test was the last item in the subnavigation menu, and now when its gone, the same thing happens on the last menuitem (now Account settings). This leave me to believe its something with the menu.
Even more strange, after recreating Create test, so that this page is now the last item. Still it's Account settings that is the page with the resetting of sessionvars...
I have through echo determined that the session id stays the same, just the variables that get unset.
I have unset($_SESSION['id']); at only one place, and this code is NOT run.
The problem just baffles me and I have no idea why this particular pages does this.
It may be totally unrelated, but we had problem with Firefox and sessions on certain pages in the past. It happened most of the times while developing and therefore refreshing a particular page, have you tried clearing your browser cookies which is where session is stored?
As an addition:
Check that you assign sessions before you write anything to the response stream.
Also we had similar problems with sessions set in a pages that were doing a redirection (i.e. a login page that if successful would set the session and redirect to the another page.)
I'm not sure about PHP but in .NET that can be overcome by explicitly setting not to terminate the response so that all headers are written to the response stream.
Fixed now, actually have no idea what I did. but I've change some html but mostly CSS.
So there is a strong posibility it was CSS-related.

Categories