|
View previous topic
::
View next topic
|
| Author |
Message |
niz85
Joined: 28 Aug 2003 Posts: 107 Location: India
|
Posted: Sun Dec 21, 2003 5:13 pm Post subject: Reducing the page code |
|
|
Hi to all of you!
Now, here is one question that is in my mind.
I have a site. And say, I have 40 pages... all of which I want to get linked from my main page. So what I do is I create a table and put all the links in it and display them on my main page. This table acts as my site's main menu and I want to display it on each and every page on the same place as well.
But, it takes a lot of coding lines (And thus the content prominence on that page decreases). So now my question is... can I put that table in an external file and can still display it on my pages. (Thus, increasing content prominence and making my sites load faster).
I hope you get what I am trying to ask.
Thanks in advance.
Best wishes
Niz |
|
| Back to top |
|
 |
Charlie
Joined: 22 Aug 2003 Posts: 3305 Location: UK
|
Posted: Sun Dec 21, 2003 9:23 pm Post subject: Re: Reducing the page code |
|
|
Hello Niz.
| niz85 wrote: | | ...can I put that table in an external file and can still display it on my pages. (Thus, increasing content prominence and making my sites load faster). |
A lot depends on whether you have additional href text links (at the bottom, say) for the SEs to follow...
If you do, you can use Javascript in an external file to write the HTML code for the buttons. The SEs won't be able to read it, but humans will.
If this "table" is the only text links that the SEs will have to follow, you will not be able to use javascript to create them. What you can do, though, is create an external style sheet to define the properties for the menu box and then contain the href links (in the main source) in div tags that call on the external sheet.
Both of these methods share the advantage of only using one line to specify the external source of the javascript or CSS, and as a result the main source is shorter and the content appears earlier.
Hope this helps,
Charlie. _________________ "Before I speak, I have something important to say."
- Groucho Marx |
|
| Back to top |
|
 |
niz85
Joined: 28 Aug 2003 Posts: 107 Location: India
|
Posted: Mon Dec 22, 2003 4:02 am Post subject: Re: Reducing the page code |
|
|
| Charlie wrote: |
A lot depends on whether you have additional href text links (at the bottom, say) for the SEs to follow...
|
No I dont have. This table is the only way for SE's to follow. So I guess now what can I do is, I shall just try to reduce the code of the table itself by putting all its properties in the external CSS.
| Charlie wrote: |
and as a result the main source is shorter and the content appears earlier.
|
content will still appear earlier as I have my table or my main menu on the extreme right hand side.
All the best to all of you
Niz |
|
| Back to top |
|
 |
Enterprise
Joined: 02 Dec 2003 Posts: 44 Location: Florida
|
Posted: Mon Dec 22, 2003 6:13 am Post subject: |
|
|
You can make the menu (or header, or footer etc.) as an include file.
There's a bit of learning curve to use included files but it's worth it.
The pages on one of my sites, free-photographs.net which is written mostly in PHP, is a fair example.
Look at the front page. It is actually five different files (header, footer, left and right columns and then the main page body) but, if you view the source code it looks like a normal html page.
The main advantage, especially with menus which may change frequently, is that when you, say, add a link to the include file it then appears automatically on all pages which saves editing time.
Another advantage is that SE's will be able to read the links.
Another example would be the 'shared border' function in Micro$oft Front Page which behaves in a similar manner and can also be read by search engines.
Visit webmonkey.com if you want to learn how to use includes. _________________ http://www.enterprisedigital.net |
|
| Back to top |
|
 |
Debs
Joined: 16 Aug 2003 Posts: 4296 Location: NY
|
Posted: Mon Dec 22, 2003 7:25 am Post subject: |
|
|
Make sure your hosting company allows the use of Includes ... whether as php, SSI, or Frontpage extensions. Each form requires special consideration by the host, not to mention php and SSI usually require special page extensions instead of the standard .html or .htm you may be used to.
There are host workarounds for SSI extensions, if the host allows or offers it. Frontpage extensions have to be installed by the host to use the FP proprietary border includes, I think you also have to be on a certain type of server (forget what it's called) to use FP extensions. I am not as familiar with php but I believe files with php includes have a .php extension or require a host workaround?
Debs _________________ Learn how to turn keyphrases into quality, well-targeted articles your visitors and SE's will love with Gary Antosh's new ebook "Web Content Made Easy!" |
|
| Back to top |
|
 |
niz85
Joined: 28 Aug 2003 Posts: 107 Location: India
|
Posted: Mon Dec 22, 2003 8:00 am Post subject: |
|
|
| Enterprise wrote: |
The main advantage, especially with menus which may change frequently, is that when you, say, add a link to the include file it then appears automatically on all pages which saves editing time.
|
I dont worry about that. Because I am using templates. And to change the menu for entire site, I just have to make changes in one file only.
I just checked out with my web hosting company. They doesnt support php. But, they support asp and asp.net. So any solutions using these server technologies?? If yes, try to give an example. So that I can view the coding and see whats happening actually. I learn best that way.
Niz |
|
| Back to top |
|
 |
Charlie
Joined: 22 Aug 2003 Posts: 3305 Location: UK
|
Posted: Mon Dec 22, 2003 10:19 am Post subject: |
|
|
Hello again.
Although SSIs, PHP, ASP or any other server side technology is a great way of making a site easily updatable, it is of no help in reducing the size of the source code, since the page has to be built in full before it is delivered to the client browser or search engine.
If you wish to reduce the size of the main page source code you need to use one of the client side methods I described earlier - external CSS or javascript. This is loaded after the page has ben delivered.
You could use these within a SSI, but there would be no advantage if you are happy with the template method you are using. I do not think it is worth investigating ASP just to create this menu box.
I think the external CSS is definitely the way to go if you need SE-readable links and reduced source code.
Hope this helps,
Charlie. _________________ "Before I speak, I have something important to say."
- Groucho Marx |
|
| Back to top |
|
 |
speedguide
Joined: 19 Sep 2003 Posts: 467 Location: Palm Coast, Florida
|
Posted: Mon Dec 29, 2003 4:04 pm Post subject: |
|
|
niz85,
Let me approach this from a different angle. Right now it's 40 pages. What about when it hits 80? Are you going to have 80 links out of your main page to those pages.
Why not just use site maps from your main page.
Look at reducing your work not increasing it. It is the only way to manage multiple sites.
Is your goal to reduce page code size or multiple page re-coding? 2 different issues.
As Charlie said, your code isn't going to be reduced for the page. _________________ Gary
- ONE is to small of a number to be a success!
Learn HOW TO create targeted, focused Content for your website!--> http://webcontenttips.com - Join Our Weekly Newsletter |
|
| Back to top |
|
 |
niz85
Joined: 28 Aug 2003 Posts: 107 Location: India
|
Posted: Tue Dec 30, 2003 5:59 am Post subject: |
|
|
| speedguide wrote: |
Is your goal to reduce page code size or multiple page re-coding? 2 different issues.
|
My goal is to reduce the page code size. At present, on my every page there are links to 40 other pages. And all the pages are been indexed properly by SE's. And these links are embedded into tables. This is taking a lot of space in my coding. I am confused what to do. If I dont display them, it decreases my "page viewed per visitor". And also the visitors dont get to see all the things which I have on my site. And if I display them, it takes a hell lot of code.
I am thinking of either creating javascript buttons so that all the code gets into an external file or I shall create proper site maps.
Thanks
Niz |
|
| Back to top |
|
 |
speedguide
Joined: 19 Sep 2003 Posts: 467 Location: Palm Coast, Florida
|
Posted: Tue Dec 30, 2003 11:34 am Post subject: |
|
|
Niz,
I'd go the site map method for a couple of reasons.
- page code will be smaller
- code will be easier to maintain
- several pages to update instead of the whole site as new content is added
- too many choices per page in my opinion - keep it to 5-10 if possible
- reduced PR
Just my 2 cents, _________________ Gary
- ONE is to small of a number to be a success!
Learn HOW TO create targeted, focused Content for your website!--> http://webcontenttips.com - Join Our Weekly Newsletter |
|
| Back to top |
|
 |
Gamezing
Joined: 30 Oct 2003 Posts: 66
|
Posted: Thu Jan 08, 2004 9:43 am Post subject: |
|
|
Most servers use SSI now... the most common extension is pagename.shtml
Here is one way you could do it with only using 1 line of code...
(I would hope to god they have perl installed heh)
Make a file like menu.cgi
use print statements in it for the html code that produuces your links...
Then you will only need a line like:
<!--#exec cgi="/cgi-bin/menu.cgi"-->
in your shtml page...
The only reason I say to do it this way is because it should work with pretty much any hosting service you find because almost all now have ssi and I would hope all have perl installed...
CGI file would be like:
#!/usr/bin/perl
print "YOUR CODE IN HERE";
But it is one way that I can think of as a failsafe any hosting provider should be able to handle way of doing it....
I really don't know what effects this will have on teh search engines though...but it should generate the html code on the page in time..for the spider to read it. |
|
| Back to top |
|
 |
edburdo
Joined: 14 Jul 2003 Posts: 1750 Location: Bangor, Maine
|
Posted: Thu Jan 08, 2004 2:05 pm Post subject: |
|
|
You can eliminate page size by using CSS. The more inline code you use (font tags, tables, etc) the larger your page is.
And the SSI method that Gamezing mentioned works well... I use that for my own sits (or a PHP counterpart)... depending on the site... _________________ Eric D. Burdo
They Made $6,513 a day With Clickbank Doing This... |
|
| Back to top |
|
 |
onlineleben
Joined: 01 Aug 2003 Posts: 208 Location: Germany and the World
|
Posted: Thu Jan 08, 2004 3:19 pm Post subject: |
|
|
Since you already use templates why not use all the good stuff mentioned here together:
use CSS to streamline the code
use external JS for the menu
and use a static link to your sitemap from all pages.
Also what Speedguide suggested is quite helpful. Create more than one sitemap to cover different subtopics of your site.
Good luck. _________________ Explore The Most Up to Date Site About How to Succeed with Adwords! |
|
| Back to top |
|
 |
niz85
Joined: 28 Aug 2003 Posts: 107 Location: India
|
Posted: Mon Jan 19, 2004 12:02 pm Post subject: |
|
|
Thanks everyone for your suggestions!
After giving it a lot of thought, I finally decided to go the "site-map" way. Obviously, I have put all that I can in external CSS sheet. The code is reduced dramatically. And guess what, my adsense income has also increased cauz now my visitors have less options to click.
Niz |
|
| Back to top |
|
 |
onlineleben
Joined: 01 Aug 2003 Posts: 208 Location: Germany and the World
|
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|