Jump to content

Recommended Posts

You know how with command style sheets and javascript and images and sound files and video clips and flash and java and pretty much EVERYTHING you can just put it in an external file so that the entire thing doesn't need to be downloaded every single time any page is opened which would waste tons of bandwidth?

 

How do I do this for html? Please help :D

 

 

P.S. I know I could create an external javascript file and use that to print out my header, but that would only work for people that let javascript run, so it's out of the question, so please don't move this to the javascript forum, thanks!

Link to comment
https://forums.phpfreaks.com/topic/45789-header/
Share on other sites

LOL. I know exactly what you mean. You don't use html for this. You use php. It's very easy.

 

php code:

 

<?php include('javascript_code.php') ?>

 

What it does is actually insert the javascript into the html page and make it run as though it was there. It doesn't really save bandwidth. It saves disk space. Change "javascript_code" to the file path. Keep the file as a php file since it works best like that. It doesn't matter if it isn't even php. - just put the javascript in there.

Link to comment
https://forums.phpfreaks.com/topic/45789-header/#findComment-223935
Share on other sites

Thanks.. that isn't what I am looking for though.. I don't use includes I have everything in 1 file.. I just want to save bandwidth.. so that the navigation thing at the top of the page which is same on every page doesn't need to be downloaded every time a page is opened.. because bandwidth is a very big concern for me right now.. disk space isn't, I don't care if it would take 300GB of disk space to do this, it would be worth it.

Link to comment
https://forums.phpfreaks.com/topic/45789-header/#findComment-226803
Share on other sites

Hmm I found a way to do it by putting the navigation stuff in one frame and putting the content in the other.

The problem is that now whenever you refresh the page it brings you back to the main page.

And also I'm worried this might be search engine un-friendly.

And I'm not able to put titles in the differant pages this way either.

 

So I would really liek to find a better way ^^

Link to comment
https://forums.phpfreaks.com/topic/45789-header/#findComment-226911
Share on other sites

I don't really understand why you are worried about bandwidth soooo much. If you want a website that becomes popular and famous you WILL use bandwidth. Also what you are doing is a waste of time. Because browsers cache images, so only they would redownload the navigation htm, which is like 2 kb or less. FRAMES do exactly what php includes. The top frame still would be refreshed and redownloaded... So yeah, php include is the same exact thing... Anyway, I sitill don't understand why bandwidth is such a problem for you.

Link to comment
https://forums.phpfreaks.com/topic/45789-header/#findComment-227211
Share on other sites

It isn't the same thing.

 

Now that it is in a frame, I can navigate the site all day long, click on as much stuff as a want, and the navigation will only be reloaded if I close the window and open it again, or press ctrl f5.

 

This is the kind of behaviour I am looking for.

 

The problem is that there are a lot of problems I am running into with frames.

 

The header is the same on all pages, it's pretty much static.

 

The title is dynamic, and is generated based on which base the person is viewing, but <title> doesn't work in a frame.

A lot of spiders (E.G. for search engines) don't like frames.

The URL doesn't show up in the address bar, it just constantly shows the home page url.

If someone types the url into their address bar or clicks on a link pointing to it, bye bye navigation.

If someone middle clicks a link in firefox, bye bye navigation.

Frames act a LOT differantly in differant browsers.

There is no way to get framesets to just scale to fit the size of the frame, so I have to set an absolute value, and then if someone has a differant font size or something it will mess it up.

And probally some other problems that I forgot to mention.

 

So I would really like to find a way to do this without frames.

 

And no using include does not work the same.

 

The whole navigation will be downloaded every single time any page is opened.

 

And the reason I am concerned about bandwidth is that I don't have a lot of it, and can't afford to get more of it.

 

And I know the navigation isn't using a whole lot of bandwidth right now, but I would like to make it more complex.

I can't right now because then it WOULD be using to much bandwidth.

 

Anyways, I really wish that someone could please just help me do this instead of trying to talk me into not doing it and thus forcing me to write a long description of my motives in order to convince you that there is a reason that I want to do this.

 

Please help x_x

 

 

Oh and also pages open faster when not as much stuff needs to be downloaded.

This is especially important to the majority of people that use the internet (dialup users).

Link to comment
https://forums.phpfreaks.com/topic/45789-header/#findComment-228442
Share on other sites

The problem is that there are a lot of problems I am running into with frames.

 

The header is the same on all pages, it's pretty much static.

 

The title is dynamic, and is generated based on which base the person is viewing, but <title> doesn't work in a frame.

A lot of spiders (E.G. for search engines) don't like frames.

The URL doesn't show up in the address bar, it just constantly shows the home page url.

If someone types the url into their address bar or clicks on a link pointing to it, bye bye navigation.

If someone middle clicks a link in firefox, bye bye navigation.

Frames act a LOT differantly in differant browsers.

There is no way to get framesets to just scale to fit the size of the frame, so I have to set an absolute value, and then if someone has a differant font size or something it will mess it up.

And probally some other problems that I forgot to mention.

 

I'm not trying to argue with you. But I use php includes with a header that doesn't change. I don't have problems with the title. The title is still dynamic. Use php variables. The browser cache will take care of it. Php includes will do a miracle and frames are looked down upon as "unprofessional."

 

It is your site, so I won't say anymore, but CONSIDER php includes.

Link to comment
https://forums.phpfreaks.com/topic/45789-header/#findComment-235633
Share on other sites

Sorry I wasn't trying to argue, I'm just confused.

 

Can you please tell me what you mean by "use php includes"?

 

In my htdocs folder I have a file called index.htm and in it is

<?$gentime=array_sum(explode(' ',microtime()));require_once("J:/Abyss/a");?>

 

In the folder above it I have a file called a that contains my website.

 

What exactly am I supposed to include? And how would that help anything? I thought that PHP was a server-side language and that telling PHP to include a file/variable/whatever is the same as copy and pasting it except it saves server disk space. It sends the exact same thing to the client as if you had just typed out the whole file and the whole thing has to be downloaded anyways doesn't it?

This isn't really making a lot of sense to me at all.

 

If there is 1 page and there is a chunk of HTML in it's source, and that chunk of HTML is also in the source of another page, how exactly does the "browser cache not redownload it"???  :s

 

And how exactly does the browser detect any differance at all between using PHP to include a file, and just putting the whole thing there in an echo, or as plain HTML outside of php tags?

 

And also, if it you think it is easy, then please tell me, how do I get <title></title> to work when it is in a frame?

 

And I know that frames suck, and aren't professional.

 

The thing is, they are the best I have right now.

 

I'm asking if someone can please offer a better solution, but it seems noone wants to. :(

 

In case I didn't make it clear already, disk space is not an issue for me, CPU usage is not an issue for me, reading/writing to disk is not an issue for me, using tons of RAM is not an issue for me.

 

My bottleneck is bandwidth. So I want to waste less of it.

 

 

And thanks again for your time everyone, I just really really want to get this working okay.. ^^

Link to comment
https://forums.phpfreaks.com/topic/45789-header/#findComment-235848
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.