[TYPO3-english] Reload/Refresh Page Content Without Reloading Page
Scotty C
superscotty19 at yahoo.com
Wed Jan 11 05:30:09 CET 2012
All,
Can anyone address this issue?
Thanks,
-Scott.
________________________________
From: Scotty C <superscotty19 at yahoo.com>
To: TYPO3 English <typo3-english at lists.typo3.org>
Sent: Thursday, January 5, 2012 1:26:52 AM
Subject: Re: [TYPO3-english] Reload/Refresh Page Content Without Reloading Page
Philipp,
Wow I didn't realize I had that many holes - Thank you so much! Here's my new setup:
(note: "demo" has been replaced with "storm")
*** FILES: ***
/fileadmin/storm/ajax/jquery... (same)
/fileadmin/storm/ajax/blank.html (same)
/fileadmin/storm/ajax/actions.js (modified as below without spaces)
$(document).ready(function() {
/ Respond / if transmitted to the anchor
if ( location.hash ) {
x = location.hash;
getContent(x.slice(1) + "html.");
}
/ / Links via Ajax reload
//$(" A: not ([href ^ = 'http://'])"). click (function () {
$("# menu a").click(function() {
url = $(this).attr("href");
getContent(url);
$(this).blur();
return false;
});
/ / Inform something that happens
$("# content").ajax start(function() {
$(this).fadeOut(function() {
$(this)
.text("")
.addClass("loading")
.fadeIn();
});
});
});
/ *
* Retrieve the content from the server
* /
function getContent(url) {
$.ajax ({
/ / Expand links to call
url : url.replace(/\html/. , "/ajax.html" ),
/ / If it worked
success : function(html) {
alert (url);
/ / Show contents clean and write
$("# content")
.removeClass("loading")
.css("display", "none")
.html(html)
.fadeIn();
/ / Address bar update
location.hash = url.replace(/\html/. , "" );
}
});
}
/public_html/typo/.htaccess (for realurl - totally forgot!)
RewriteEngine On
RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php
/public_html/typo/typo3conf/localconf.php
// Code required for RealURL
// reference: http://www.typo3-unleashed.net/t3u_realurl.html
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array (
'init' => array(
'useCHashCache' => 0,
'enableCHashCache' => 1,
'enableUrlDecodeCache' => 1,
'enableUrlEncodeHash' => 1
),
'preVars' => array (
array (
'GETvar' => 'L',
'valueMap' => array (
'de' => 1
),
'noMatch' => 'bypass'
),
array (
'GETvar' => 'no_cache',
'valueMap' => array (
'nc' => 1
),
'noMatch' => 'bypass'
),
),
'postVarSets' => array (
'_DEFAULT' => array (
// all news display stuff
'date' => array (
array ('GETvar' => 'tx_ttnews[year]'),
array ('GETvar' => 'tx_ttnews[month]'),
array ('GETvar' => 'tx_ttnews[day]'),
array (
'GETvar' => 'tx_ttnews[tt_news]',
'lookUpTable' => array (
'table' => 'tt_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted AND NOT hidden',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array (
'strtolower' => 1,
'spaceCharacter' => '-',
),
),
),
),
// gallery
'show' => array (
array (
'GETvar' => 'tx_lzgallery_pi1[showUid]',
'lookUpTable' => array (
'table' => 'tx_lzgallery_galleries',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array (
'strtolower' => 1,
'spaceCharacter' => '-',
),
),
),
),
),
),
'pagePath' => array (
'Type' => 'user',
'UserFunc' => 'EXT: realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'Space character' => '-',
'ExpireDays' => 3,
'Rootpage_id' => '1 ',
),
'fileName' => array (
'defaultToHTMLsuffixOnPrev' => 1,
'index' => array (
'rss.xml' => array (
'keyValues' => array (
'type' => 100
),
),
'print.html' => array (
'keyValues' => array (
'type' => 98
),
),
'ajax.html' => array (
'KeyValues' => array (
'type' => 101
),
),
'_DEFAULT' => array ('keyValues' => array ())
),
),
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['t3u.local'] = $TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'];
*** TS SETUP (thanks for the header tip!) ***
ajaxcall = PAGE
ajaxcall {
typeNum = 101
10 < page.10
config {
disableAllHeaderCode = 1
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
} # end config
} # end ajaxcall
page = PAGE
page {
typeNum = 0
page.includeJSlibs.jquery = fileadmin/storm/ajax/jquery-1.7.1.min.js
page.includeJS.ajax = fileadmin/storm/ajax/actions.js
bodyTag = <body>
10 = TEMPLATE
10 {
template = FILE
template.file = fileadmin/storm/ajax/blank.html
workOnSubpart = DOCUMENT
subparts.CONTENT < styles.content.get
subparts.MENU = HMENU
subparts.MENU {
entryLevel = 0
special = directory
# the starting point of the menu tree
special.value = 187
wrap = <ul class="guide-menu"><li class="guide-menu-title">Sample Menu</li>|</ul>
1 = TMENU
1 {
NO.subst_elementUid = 1
NO.doNotLinkIt = 1
NO.allWrap = <li><a href="javascript:" rel="#guide-content{elementUid}">|</a></li>
} # end 1
} # end subparts.menu
} # end 10
config {
simulateStaticDocuments = 0
baseURL = http://demo.stormat.ca/
tx_realurl_enable = 1
} # end config
} # end page
I don't have any example.org/ajax.html stuff ... am I supposed to?
As you'll see, the url for testing is http://demo.stormat.ca ... and it's messed up. Aside from the fact that the AJAX/TYPO3 cocktail isn't working, for some reason there's also my main site's template showing up below(?)!
Your advice is so helpful - thanks again!
-Scott.
________________________________
From: Philipp Gampe <typo3.lists at philippgampe.info>
To: typo3-english at lists.typo3.org
Sent: Wednesday, January 4, 2012 2:02:12 AM
Subject: Re: [TYPO3-english] Reload/Refresh Page Content Without Reloading Page
Hi Scotty C,
Scotty C wrote:
> / / Expand links to call
> url : url . replace ( / \ html /. , "/ ajax.html" ),
> / / If it worked
> success : function ( html ) {
I think here is the first problem. This replace line does not look correct.
First of all, the spaces should not be there:
url.replace( /\html/. , "/ ajax.html" )
and your are replacing html somthing with ajax.html.
Please check that the replacement worked by calling
alert(url); directly afer success.
Does example.org/ajax.html exists on your site? (realurl configuration)
> headerData.10 = TEXT
> headerData.10.value = <SCRIPT language="JavaScript" type="text/javascript"
> src="fileadmin/demo/ajax/actions.js"></SCRIPT><SCRIPT
> language="JavaScript" type="text/javascript"
> src="fileadmin/demo/ajax/jquery-1.7.1.min.js"></SCRIPT>
You should use:
page.includeJSlibs.jquery = fileadmin/demo/ajax/jquery-1.7.1.min.js
page.includeJS.ajax = fileadmin/demo/ajax/actions.js
This will make sure that both are in the correct order and this is much
cleaner. You should not use page.headerData any more for JS or CSS.
BTW, you include both JS files in the wrong order. This might lead to JS
errors, because the library is not yet loaded.
Best regards
--
Philipp Gampe – PGP-Key 0AD96065
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
More information about the TYPO3-english
mailing list