Results 1 to 9 of 9

Thread: Buttons and page redirection

  1. #1
    Join Date
    Jan 2011

    Buttons and page redirection

    I've taught myself some web dev and thought of a question re buttons.
    When I'm doing my buttons, i'm linking to another html page. So this means for every page I have a separate html page (Which I'd expect) but it means on every page I have to write all the html for things that are identical on every page, such as background, buttons, layout formatting etc etc.

    Is this the norm or is there a better way, like is it possible to make templates where you only have to replace the things you actually want to change but don't have to rewrite (well ok, copy and paste) all the html code every time i want a new page.

    It would seem to me and my limited knowledge that I will have to keep all the code in every page (unless I use JS or frames but i dont really want to) but I was thinking, if a company has a massive website surely they dont have loads of html files that all contain code for the borders/buttons etc etc or do they?


  2. #2
    Join Date
    Aug 2009
    Easiest way to do it would be to piece your pages together from a webserver.
    Do you know any server side languages, such as PHP?

  3. #3
    Join Date
    Jan 2011
    Quote Originally Posted by thraddash View Post
    Easiest way to do it would be to piece your pages together from a webserver.
    Do you know any server side languages, such as PHP?
    I dont actually, but I'm a programmer (not done web before though) so I'm sure i could learn without too much trouble. how would it work in php then? I'm obviously not looking for a php lesson, or any code, but just an explanation of how you use it to build ur pages.

    How are websites usually put together; with server-side code?

  4. #4
    Join Date
    Aug 2009
    I can't think of a better way than to use a server language.

    As a basic template example:

    HTML Code:
    <div style="border: solid 1px black;">HEADER</div>
    HTML Code:
    <a href="#">Link 1</a>
    <a href="#">Link 2</a>
    <a href="#">Link 3</a>
    HTML Code:
    <div style="border: solid 1px black;">FOOTER</div>
    Then just add them to a page (this is the really simple version btw)...

    HTML Code:
    <!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" xml:lang="en" lang="en">
    		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php require(header.php); ?>
    <?php require(navigation.php); ?>
    <?php require(footer.php); ?>

  5. #5
    Join Date
    Jan 2011
    Ah very good. I'd tried doing something similar with html files actually. Worked but couldnt quite get formatting right.

    What's the differences in the many server-side languages then; why use php over, say, asp?

    I appreciate your help!

  6. #6
    Join Date
    Aug 2009
    There is actually a website called that describing what you've just asked :P


    You can't be good at everything, I just so happened to learn PHP and it has done all that I could ask for.

    Good luck making your choice.

  7. #7
    Join Date
    Jan 2011
    ah cheers for that. So PHP is more flexible with databases and server compatibility, is like C++ (which I have coded in), is faster and allows me to use free tools and servers?

    Sounds like a no brainer to me. Thanks for all your advice!

  8. #8
    Join Date
    Dec 2010
    I am new at this malarky too and have been experimenting with server side html includes. (No need for php or asp etc.)

    You simply create one file with the content to be duplicated elsewhere and call it what you like.

    Then in your html doc you put the following in where you would like the included segment to be inserted:-

    <!--#include file="filename.html" -->

    You save this file as whatever.html or .shtml (apparently the latter is preferred by some servers, although I don't know why).

    The resulting page in the browser looks like a fully formed page.

    You can have many includes in one document and, if you wanted to, you could make a template containing all of the includes for future use.

    I heard, somehwere along on the line, that using includes speeds up page loading, as the included data is cached.

  9. #9
    Join Date
    Jan 2011
    Cheers for that tip. Tried that myself but the formatting never came out 100% perfect. Done it the PHP way n it's all dandy

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.10164 seconds
  • Memory Usage 2,929KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (4)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (9)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates