perl - Run Hypnotoad HTTP server to serve up XHTML page -


i having bit of problem serving dot xhtml page using hypnotoad.

the xhtml file starts off perhaps not declaring allow hypnotoad display other text when head on localhost port 8080.

<?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en"     "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">     <head>         <meta http-equiv="content-type" content="http://www.w3.org/1999/xhtml; charset=utf-8" />         <title>             index         </title>         <link rel="stylesheet" href="book.css" type="text/css" /> 

when open page locally without server in middle renders fine in firefox, when created myapp.pl , stuck in sub-folder name of public serves text on port 8080.

any appreciated.

i'm not familiar perl, not it's headers though try following...

require http::headers; $h = http::headers->new; $h->header('content-type' => 'application/xhtml+xml'); 

of course you'll need check if client supports xhtml via client's accept header. keep in mind microsoft thinks ie7 literally supports . wildly far truth.

i serve xhtml application/xhtml+xml @ site , use php if you're familiar and perl may bridge bit easier...

if (isset($_server['http_accept'])) {  if (stristr($_server['http_accept'],'application/xhtml+xml'))  {   header('content-type: application/xhtml+xml');  }  else {header('content-type: text/html');} } 

i'm not sure perl's equivelant of php's include('file.pl'); though want structure.

_0_header_0 // primary header file starts includes tree, so-to-speak.

_0_header_1_base // determines relative , absolute path both local/live server exact same code runs on local/live servers.

_0_header_2_sql // connect database able fetch content.

_0_header_3_sessions // sessions, e.g. signed-in members/admins/etc, should handled @ point.

_0_header_4_classes // establish programming classes here.

_1_functions_date // site-wide functions such converting unix epoch in human readable date, other functions, etc. ...

_2_includes_01_xml // @ point no longer able send headers.

_2_includes_02_dtd

_2_includes_03_head

_2_includes_04_title

_2_includes_05_meta_0

_2_includes_05_meta_01_description

_2_includes_05_meta_02_keywords

_2_includes_05_meta_03_language

_2_includes_05_meta_04_robots

_2_includes_05_meta_05_redirect

_2_includes_06_base // use base element set default base path.

_2_includes_07_css

_2_includes_08_js // never put javascript in body element or have horrid mess.

_2_includes_09_body

...

i'm not familiar hypnotoad http server (though futurama reference). ideally want akin apache rewrites , have content served main handlers. in essence file in directory serve content sometimes...for there no actual directory, @ least custom pages. when have established modules (e.g. blog, email, forums) you'd move main handler files that.

it's general approach spend hours getting in though it's intended more of direction. doing single files hoards of includes , uncomfortable things databases reasons such not being able copy folder , site backed up. long have backup system in place build such approach new version , attempt break things down smaller versions. when have fundamentally different approach code wise it's okay have version might months year or 2 release. keep refining on , on , on , push high standards (e.g. xhtml application/xhtml+xml firefox (since other browsers won't give hide page , give error outright). has been general approach , have own web platform can run circles around other platforms i've seen doing things need, want , do.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -