Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Caching A Part Of A Page?


I am working on a custom banner generator for some of our users.

Its basically a flash banner that can take vars for colors etc, so users can integrate with their sites colour scheme.

Its set up currently with the banner at the top as a preview, with e.g. .swf?color1=00000&color2=45efef in the object and embed tags.

Below this is a script that is 3 nested for loops, that increment a var each and convert that to hexidecimal. The three hex refs are then concat'd together, and set as a CSS background to a transparent gif with an href around that calls the same page with the new colors in the url, which get passed back to the flash movie. (hope im making sense here :))

So theres about 500 or so (im incrementing the vars by two,otherwise its way sloooow) <a><img></a> that have to be generated on each page load. Im wondering how and if i can speed this up?




View Complete Forum Thread with Replies

Related Forum Messages:
Page Keeps Caching Old Data, How To Fix?
i have a php page that has a series of check boxes in it and you press the update button after unticking some boxes and ticking others. after the page updates the changes actually take place in the database but the page displays the old state where it was before you ticked and unticked the boxes. as soon as you press Ctrl + F5 it actually updates the page to what is in the database.

how can i fix this so when i press the update button it refreshes and doesnt cache the old state?

i have the following in the header but it dont seem to work, is there anything else i need to do?

<meta http-equiv="pragma" content="no-cache">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

View Replies !
Page Caching For Usability
Is there a way to cache the page view, without having to scroll the whole page again after you have visited a link? Is this a browser feature only? If so, firefox remembers some sites, but don't do the auto scrolling on my own site.

View Replies !
How Do I Make My Page Stop Caching?
I have a PHP page that holds info that comes from a MySQL database. I have another page that modifies the info to the users liking, and then sends them back to th first ppage with all the info. Problem is it shows up the same as before. For example, if I delete one of the entries, it's still there when I get sent back.

View Replies !
Page Caching, MVCC, Postgresql
I had a problem today where I had an editor page (edit2.php) that
posted data to PostgreSQL, and then a view page (view.php) that read
it in and displayed it. At first I thought this was an MVCC issue in
PostgreSQL because it was not displaying the latest changes, but the
second-to-latest changes. The end user was using IE 5, so he saw the
problem, but I was using Mozilla in RH9 Linux, so I never saw the
problem. Turns out it had nothing to do with MVCC feature in
PostgreSQL.

I resolved the problem by adding this in my banner.php that loads with
a require() at the top of my HTML in order to display a banner on each
page.

if ($nocache_page) {
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the
past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
}

and on pages where I needed to ensure no cache was used, I implemented
this feature by simply putting

$nocache_page = TRUE;

in it before banner.php was called.

By using the condition check, it permits me to have some pages to
cache and other pages to not.

View Replies !
Template For Page Caching, Headers And Gzip
like most new starters, i've struggled with page caching and delivering headers properly. i've spent ages trying to find some cut-and-paste code that does everything i want it to do, and in the end i had to read a few books and write it myself.

i admit that this code is probably far from perfect. there are probably loads of better ways of doing it, but.... it works. and when you're starting out, that's all you want it to do. Code:

View Replies !
Page Loades Part Of The Page
the below code is kinda working but its only loading part of the page, when I do a page refresh the rest of the page loads.  the part of the page that is not loading correctly is the bottom 1/2 which displays images. Code:

View Replies !
Getting Part Of Another HTML Page
I'd like some help with writing a script that grabs part of another HTML page. For example : I want to grab the content of a HTML page that contains the following strings :

<!-- begin --> and <!-- end -->

Then I want to get all the content (including these two tags) that is in between the two tags.

View Replies !
Refreshing Part Of A Page
Can some one help me if it is possible to refresh a part of a page,
without reloading the whole page. Let's say, i want to add a small
message box to my webpage. After writing a message, the user presses
the send button and i want only this part of the page to refresh and
give him a status message saying his message was successfully received.

View Replies !
How To Let Php Reflesh Part Of Page
I want to write some code that when some variable condition is met, it will change a table cell value (only reflesh that value instead of the whole page),

I used to think it as calling JavaScript function first, which in turn change that table cell value in the page. But I don't know how to let php call JavaScript, or mimic click button action to call JavaScript.

View Replies !
Refreshing Certain Part Of Page
I need help with how to get my shoutbox I made to automatically refresh when someone posts a new shout.

View Replies !
Selective Rendering Of Part Of A Page
I want to skip the rendering of certain parts of a Web page if the
user doesn't have a certain permission (e.g. a cookie). I'd like to do
it along these lines:

<p>Anybody can see this paragraph.</p>
<? start_protected_section($got_permission); ?>
<p>Not everybody can see this paragraph.</p>
<? end_protected_section(); ?>

Is it possible to disable the rendering of a section outside the code
like this (perhaps by setting a PHP flag to redirect subsequent
output)? I don't really want to complicate things by moving part of
the page into a separate "include file" or mixing the HTML and PHP by
using a here-document (the <<<END syntax).

View Replies !
Include Specific Part Of Page
i know that the include() function allows you to include a page with php but how do i only include PART of a page like specific tables? what im trying to do is get the certain parts of this page: ...

View Replies !
Need To Copy Text From One Part Of Page To Another
It has been great so far but I hit a road block on one thing and I figured the brilliant minds here could help. This site isn't in a database because its 3000 pages of HTML now and we figured we can do work arounds to make it look right. We are starting a database for future data though Code:

View Replies !
Extract Each Part Of A Page That Are Enclosed In A <b>-tag
I would like to extract each part of a page that are enclosed in a <b>-tag, but ONLY if there are no other tags enclosed.

<b>some text</b> <-- a match
<b>some text <i>in italic </i></b> <-- should NOT match

This is what I have so far:

$pattern = "/<b>(.*?)</b>/si";

preg_match_all($pattern, "<b>some text <i>in italic </i></b>", $out);

Any thoughts?

View Replies !
Loading Part Of Page Using Includes
If I use includes to create a website pages, how can I make sure that the header part I where i have a flash movie, will load only once?

View Replies !
Get The Value You Pass From One Page As Part Of The Query String?
How do you get the value you pass from one page as part of the query string i.e

htttp://www.somesite.com/postage.pgp?newsid=2

How you you get the value of the variable in the next page, stumped.

View Replies !
How Do U Code A Printable Output Of A Part Of Your Page?
im trying to develop a website and im wondring how to make a connection with a printer and make a printable version of the page

View Replies !
Change Part Of A Web Page After X Seconds Delay?
I was asking about how to pass a new array number with a page refresh and someone responded: But what I don't understand is why you want to change images like that on page reload, I have never seen it before.

That raised the question to me - if I have written out a web page in PHP that has an image displayed on the page - is there a way to have it change the image every 10 seconds?

Could you do this with a For Each or While type loop? I thought once the script was parsed it then wrote the page source and it doesn't change on the screen.

View Replies !
Php Form To Allow The User To Enter Part Of A Last Name And/or Part Of A First Name To Display The Data
I'm sure this is not a hard thing to do, but for some reason I can't get my mind to figure this out. I have a database with Name, Address, and Car Type tables. 

I'm just trying to do a simple php form to allow the user to enter part of a last name and/or part of a first name to display the data in the tables. My brain has twisted around this and I cannot figure it out.

View Replies !
What Caching Does.?
I am currently writing a PHP program and I am just wondering what Caching does.

View Replies !
Caching
I want to make it so that browsers will cache the images, scripts and css pages from my site, but not the php pages themselves. Is all I need to do add this?

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');

View Replies !
PHP Caching
in my php.ini I have set the following properties:

ob_start("ob_gzhandler");

in order to speed up my pages. The problem is I have a user profile page and when the user updates their picture, the new one won't show up unless they refresh the page. Even when the click on the picture which is pointing to a .jpg file.

it shows the old .jpg file from cache unless they refresh that page as well. How can i cache the php pages so it loads faster, but on certain pages remove this cache so it reloads everytime? i'm also using these headers in the profile page:

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

View Replies !
Caching Images
Is there a way to set different levels for different content?

I have been looking at different sites with cache tuts and docs and many seem to imply this can be done how fail to mention how. Each one states the syntax for producing http headers for the document being requested which is straight forward enough, but what about the objects within the document?

I would like to cache images for a relatively long period of time but allow dynamic content (php) to be updated very frequently.

Anybody have any input/links?

View Replies !
Caching Pages With Php
In this post I will try to give a view of what is the custom caching with php, why and how we can use it.In the modern days, most of the sites are database driven. That means that your site is actually an application which retrieves data from a DBMS ( database managment system, eg MySQL) , parses the data and shows the result to the user. Most of these data are usually don't change frequently or don't change at all, and the reason that we use the database is that we can easilly update the site and the content.A problem that this process creates is the server overhead. Every time we execute a query in the database, the instance of our script will call the DBMS, and then the DBMS will send the results of the query. This is time consuming, and especcially for sites with heavy traffic is a real big problem.How we can solve this problem?There are two ways to solve this if you want to make your site faster. First is optimizing the quesries, but we will not talk about this at the present article. The second and most valuable is using some kind of custom caching technique. Custom caching with phpFirst let me explain the idea behind custom caching. When we have dynamic pages that their data is not updated frequently, we can use a 'system' that will be able to create the page, and then store it for later use. That means that after the page's creation, our application will not run the queries again in order to display the page, but it will show the cached one. Of course this system must be able to keep the cached pages for a time period that we will set.Let's code itHere is a simple class that will do the job. Let's see the code first:

View Replies !
Caching Php Pages?
HOW to make my pages freshly loaded by default. this is a problem when pages get cached that query databases because when you go there you get the cached page as opposed to the page updated with the database's info.

how do you get pages to automatically load themselves from the server, not the cache?

View Replies !
Caching Problem
I have a problem with caching. Basically I have input forms where people add content but it seems to retain the pages in the cache so when they go back to edit them, they get the old cached version which does not reflect their changes.

To see the changes you have to force a refresh using CTRL + F5.I've got this at the top of my code file but it doesn't seem to help:

header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");

View Replies !
Caching Problem With GET
When I insert into my code a redirect to the current page, e.g.

<A HREF="news.php?item=4">News</A>

It doesn't work and seems to bring back pages that have been cached by my server (I'm hosted by an ISP) and processes the code as if a different value has been passed in. If I change it to:

<A HREF="news?item=4">News</A>

i.e. remove the extension, then all seems to work fine, but all the sites I've been to include the extension.

View Replies !
Sessions And Caching
I've constructed a series of 5 forms for the user to fill in, at the end of the series, there's a final page which displays the input, and allows the user to go back and edit each form.

Each form has 4 "modes". They are:

1 (One)- User input of info into blank page
2 (Two)- Validation/handling of the above input
3 (Three)- User editing existing info
4 (Four)- Validation/handling of the above

The final form (the one which reviews the input) sets $_SESSION['edit'] to true. Quite straightforward eh? So if any of the 5 pages is accessed and ($_SESSION['edit']) then I've made the script go to mode 3: PHP Code:

View Replies !
PHP & RSS -- Caching Requests
To start, I'm pretty experienced with a lot of aspects of PHP but I've never gotten into caching.

On a lot of sites there's a request of how often you grab an RSS feed. For instance, on Del.icio.us there's this message:

"Please do not poll any single RSS feed more often than every 30 minutes. RSS feeds are not updated more than twice an hour, and you will receive an error if you try to crawl more frequently."

What's the best way to pull RSS feeds and still abide by sites like del.icio.us' terms/requests?

View Replies !
Caching IP For Hit Counter?
what's the easiest way to cache an IP for use in a page hit counter, so that if the viewer clicks 'refresh' the counter won't increase; ie it'll only increase when unique viewers access it.

View Replies !
Caching Jpg Files
A question about caching jpg files, I have pages where dozen of jpgs
are displayed at once. Those jpgs come from resizing jpgs, so this is a
costly way for server (computing jpgs and send them to client).
So is there any way to cache resized jpg to avoid them being resent
every times ?

View Replies !
Session Caching
I submit a value in a form on go to the next page, where I fill in another value and post that to the next page, then I hit the browser back button to change 1 of the values and resubmit but the problem is that it is not updating the overwritten value?? Is this a session problem or my browser?? ANd is there a way I can solve this???

View Replies !
Browser Caching ?
Let's say I have a page that is primarily HTML but I added a few small parts
that are PHP, for example a random banner. The page is in no way PHP driven,
it just has some some random stuff like the banner and/or a tip of the day.

What bothers me is that the PHP page won't be cached, so if the page has a
lot of links and, on average, the user clicks ten links (hitting the back
button after he does that) my bandwidth usage increases tenfold.

I think I can send cache headers but I don't know much about them. Is it
possible to set it for, say, an hour so that if he hits the back button
he'll get the same banner/tip of the day that he originally got (because
he's looking at his cached page) and only after an hour will he get a new
random banner/tip ?

View Replies !
Caching Classes
I'm getting a really odd behavior with php. It is caching my classes.

I have a very simple file:

<?php
class testclass{
}
?>

The first time I run the page it works correctly and creates the class. If I run it again it simply does this:

Fatal error: Cannot redeclare class testclass in C:Inetpubdefaultindex.php on line 2

It doesn't matter what class name I use. The first time it executes it saves the class for future requests.

My setup is IIS 6 on Windows Server 2003 PHP 5.2.1 installed as an ISAPI extension. If I restart IIS it seems to clear this cache and executes correctly the first time. But then it stays cached.

*note This also occurs with define such as:
define('test', true);
executes the first time, states it is already defined the second.

Anyone have any idea what would be causing this to happen? I've never seen this situation before.

View Replies !
Pre Caching Screen
I have a site that generates whois quieries, securiy reports on domains etc and thus because of this it can take a while for pages / content to be cache and loaded into the browser. I was wondering if there is a way to create a loading screen until the page is generated. Perhaps this could be done with javascript however the rest of the site is php and id like to keep it that way. any code examples or can help in some other way?

View Replies !
Preventing Caching In PHP
I am trying to force the back-button to re-load a page in IE, but even the following stripped-down script, based on http://uk.php.net/header, is not working:

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

$timenow = time();
echo date("r",$timenow);
?>

I'm using php 4.3.4

(Note that the ASP script at http://support.microsoft.com/kb/199805 does work, but I haven't been able to successfully combine it with my existing php code). Am I missing something very basic here?

View Replies !
Smarty Caching
Smarty is currently creating cache files with the owner:group nobody:nobody. This is preventing unlink and chmod from working. How can I change this to the owner of the Smarty class?

View Replies !
Caching & Headers
One of the more typical ways to determine if a file needs to be recached is by using filemtime() the check it's modification date against a sort of expiration date. The expiration date is typically something that could come from the database.

I'm trying to circumnavigate the database entirely...so I can't check the modified date against a dynamically created date (the settings for this come from the db). I haven't tried this, but it does seem possible that I could set the modified date by hand using a header(). However, I'm not sure if all browsers would deal well with this and perhaps more importantly this is a bad practice.

I could access the modified time (as I would set it in the future) and if it was less than the server time() now then we'd recache it.

The other thing I'm wondering about, perhaps there is a way to access the header('expires') setting via php?

View Replies !
Caching Forms In IE 5.5
When a user hits the back button to return to a form(ex: to fix an input error), how can you cache the field values in IE 5.5, so that the user doesnt have to retype everything?

For IE 6 this works:

header("Cache-control: private");

However it has no effect on IE 5.5

View Replies !
Caching Output
I am having difficulty finding the best way to cache output of PHP functions. I basically have a set of PHP functions that I would like to cache the HTML output of. My plan right now is to cache each output individually, using a caching prog like cache_lite, as 1.cache, 2.cache, etc.

I'm caching them separating because I would like the user to have the option of deciding where they want each PHP output displayed. Then, I will use fopen, fread commands to read the output in the main HTML document. I am worried that this isn't a very optimized way because I would have to issue separate fopen calls for different files. If there are many users, this might hurt performance. Is there a better way to store HTML output of separate PHP functions? Perhaps in just one array?

View Replies !
Output Caching
I am facing a problem that user enter user name, password and clicks on login button. After clicking button i do Login authentication and load user profile and prefrences during this backgroud process i want to show "Please Wait. Loading..." message on screen but it is not showing this message it show this label after all procesing and when page is completely loaded.

One same problem like. We query the database suppose there are 100 lines we have to show all on same page then i want to show result as Google do as soon as it found result it show it on screen not as load complete page in one time. What is this problem. May be i am not asking in technical language so sorry for that.

View Replies !
Magpie RSS Caching
I am using Magpie RSS and want to change the Caching period to half an
hour instead of one hour.

I have modified the line in RSS_CACHE.INC so that it reads:

var $MAX_AGE = 900; // when are files stale, default one
hour

but this doesn't seem to have any effect. It still only gets a fresh
version of the file every hour.

View Replies !
Preventing Caching
I am trying to force the back-button to re-load a page in IE, but even the following basic script, based on http://uk.php.net/header, is not working: Code:

View Replies !
Image Caching
Is image caching in php possible. I have my site http://www.***********.com. It consists of large amount of repeative images Is it possible that i retreive image from the cache memory?? Or is it any other suitable way that image don't get loaded from server regularly

View Replies !
Query Caching
SELECT avail_credits from credits where login='$login' limit 1

The above query repeats every 30 seconds.

The first time the query is run, it returns the correct result. After that, the result returned is the same, even though I know for a fact that the value has changed.

So, it appears mysql is caching the query. Hence, I poked around for a way to turn off caching, which turned up:

SELECT SQL_NO_CACHE avail_credits from credits where login='$login' limit 1

Specifically, I'm using AJAX to carryout the repeated queries.

Any suggestion on how to solve this problem?

View Replies !
Quality Caching
I have been running sites on php and mysql for a few years now and some of my old sites have become _really_ clunky with out of date code and cumbersome queries to my databases.

What is particularly silly is that many of the pages call the database to check up on data which only get updated a few times a week. So I am planning to set up the site to run a little faster. I have had a couple of ideas of how to do this and wanted to get anyone's thoughts/experience around this.

My thought is to have a static php page (with just adserving as an included script) which gets rewritten every time I or a user updates the database... is this a good way to progress? How does everyone else do caching?

View Replies !
Caching Question
I have a database table "categories". The content of this table do not
update regularly, So I have imported the content of this table in a
text file "categories.txt". Now I have several mysql queries like

$cat_query=mysql_query("Select * from sbbleads_categories where sb_id=" . $cid );
if ($cat=mysql_fetch_array($cat_query))
{
$catname=$cat["sb_cat_name"];
$category=$cat["sb_id"];
}

I want instead of quering mysql database every time which can use much
CPU resources Can I query the text file "categories.txt"?

View Replies !
Caching JS Generated
Im developing a service where my registered users must include a javascript on their websites.

Since each user has different config settings on my service, they must all identify themselves with an ID, for example, user John Doe must include this piece of code in his site:

<script src="http://blabla.com/script.php?id=384" type="text/javascript"></script>

That way the javascript that will get printed will use his own settings. What i need to do now, is to reduce my server's requests by properly caching the data. A friend told me to use this in the top of script.php: Code:

View Replies !
Caching With Header
I'm having difficulties trying to get PHP caching using header with apache2's mod_cache. From my understanding, PHP header caching using cache-control and expire needs mod_cache running. I have set a default timeout in mod_cache but it only caches some contents. Using the PHP header should enable us to cache more stuff and overwrite the expire time set in cache_control. I've done a few tests where header cache expires after 30 secs which works but afterwards it always refreshes the contents from the server.

View Replies !
Http Caching
Most of my site is dynamic in nature. What is worse is that every page is customized towards the user. So for every logged in user the page differs, however for the not logged in users its the same. Two questions:

1. Regarding authentication and http caching, are there any security risks?
2. In the situations above, would it still be desirable to support caching (I was thinking of using etags)

View Replies !
Apache 2.0.45 + PHP 4.3.1 Caching Problem
I had some hardware problems with my old machine so I
had enough reason to set up a new one :

Gentoo 1.4 + Apache 2.0.45 + PHP 4.3.1 + MySQL etc.

I took the applications from the old server and put them
onto the new machine. So far so good.

After a while I saw some *really* strange behaviour :

What ever I did, IE cached every dynamically created page.
I thought I could remedy the problem by adding some
meta pragma HTTP heads into the html templates.

Didn´t work.

I added hardcoded Header Flags directly into the
php code.

Didn´t work.

On the old machine everything works fine.

IE just shows the *current* db generated content
once you press ctrl + F5.

Neither just pressing F5 nor hitting the link to
the page again shows the current content.

That is really bad if you´re running a message board
or something with changing data per minute

Is there anything new to apache or php I am not aware of ?

View Replies !
Caching Php Files Difficulty
I need to execute a php file with mysql requests on the server without the file being sent to the client. I'd rather have the result of the execution of the php file being written in a plain html file on the server. I've tried turning output buffering on, but unable to get content.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved