CakePHP + HTML5 Prefething = Logging Out - firefox

After adding HTML5 Prefetch links to head section of default.ctp, all firefox users (in CakePHP application im working on) are keep getting logged out after next page refresh.
Any ideas how to make CakePHP prefetch-friendly?
Here is example prefetch links placed inside head of the page:
<link rel="prefetch" href="/" />
<link rel="prefetch" href="/users/" />

Check if this could be your problem.

Related

URL rewrite issue not loading .css

I'm porting an old site to a new template and am having problems with the Windows 2008 rewrite module. The link I'm trying to rewrite looks like this:
http://ltweb2008.serveronline.net/product.php?pID=75
and brings up the page just fine. Then I apply the new URL and it loads the proper content, but doesn't load the template's style.css file anymore.
http://ltweb2008.serveronline.net/product/75/any-text-here
The problem seems to be that the company who made the template (canvas) put the main .css file in the root directory, but loaded all the rest in /css. Now I can't get the main .css file to load using the rewrite and when I move it down to /css it only displays a blank page, though when I check out the page source it's all there.
With this the page shows but is not using style.css (with rewrite):
<link rel="stylesheet" href="style.css" type="text/css" />
With any of these the page is completely blank (with rewrite):
<link rel="stylesheet" href="/style.css" type="text/css" /> OR
<link rel="stylesheet" href="/css/style.css" type="text/css" /> OR
<link rel="stylesheet" href="http://ltweb2008.serveronline.net/style.css" type="text/css" />
I'm using this for the Pattern:
^product/([0-9]+)/([^/]+)$
And the Rewrite URL:
/product.php?pID={R:1}
Does anyone know what I'm missing?
one solution is that use absolute path (ex /css, or /js rather than just css/, /js but this is not looks a reliable solution since we've to change it on all files,
This is because your relative URIs have their base changed. Originally, the base is / when the page is /product.php?id=75, and the browser properly fills in relative links with the / base. But when the browser goes to a page like /product/75/any-text-here the base suddenly becomes /product/ and it tries to append that in front of all relative URLs and thus none of them load.
You can either make your links absolute, or change the URI base in the header of your pages (inbetween the <head> </head> tags):
<base href="/">
Maybe you need one thing, maybe both, I didn't test, but this solved it for me:
1.) ADD THIS in page_load :
Page.Header.DataBind() ' Needed because we have <%# %> codeblocks in the HEADER (seems header only causing this) WITH the AjaxControlToolkit running on the page. That's what broke it until we put in this and put in the pound instead of = sign in the html.
2.) Add this in ASPX:
<%# MasterType VirtualPath="~/dir1/dir2whateverdir/MasterPage.master" %>

Print order in Magento 1.7 not using theme CSS

I've successfully setup my theme and using it for the rest of my site on Magento 1.7, however the print order screen (http://<my-domain>/index.php/sales/order/print/order_id) seems to be ignoring local.css and using all of the styles from styles.css.
For example button.button span from styles.css is being used for the Close button when I have this in local.css and the rest of the site uses this. I've even tried to set a more specific selector but this gets ignored.
Is there something simple I'm missing on this screen as I haven't had this problem anywhere else.
Edit: Workaround solution: I viewed the source HTML of the page and can definitely see that local.css is not loaded anywhere in the page. On other pages I can see it being pulled in. Seems like a bug in Magento 1.7.0.2, so I copied /app/design/frontend/base/default/template/page/print.phtml to my template path(/app/design/frontend/default/<my-theme>/template/page/print.phtml) and fixed.
It seems this block isn't doing what it's meant to do and does in other pages
<head>
<?php echo $this->getChildHtml('head') ?>
</head>
So in my copy of the file in my template directory I added the line below just before </head> which worked.
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('css/local.css') ?>" media="all" />
I logged a defect here: http://www.magentocommerce.com/bug-tracking/issue?issue=15841

CodeIgniter and jQuery Mobile 1.2

I have a CodeIgniter web app I'm trying to convert (UPDATE: I'm trying to overlay the JQM UI) [to a jQuery Mobile app]. I'm having problems setting up tabs that link to my CodeIgniter controllers.
This is the code in my "header.php" view - inside a <div data-role="page"></div>. This is called by a main controller, which works fine. Now, the problem: I am trying to set up my jQuery Mobile navbar tabs to call a new controller called inbox.
<div data-role="footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li>
Inbox
</li>
</ul>
</div>
</div>
Without jQuery Mobile, the link works fine and triggers the Inbox CodeIgniter controller, but with JQM enabled in my header.php view, I get a "404 Not Found" page when I click on the Inbox tab.
Update - this jQuery code in the html head:
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/all-mobile.css" type="text/css" media="screen"/>
<link rel="icon" href="<?php echo base_url(); ?>assets/images/logo.png" />
<link rel="apple-touch-icon-precomposed" href="<?php echo base_url(); ?>assets/images/logo.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
Update 2: If I insert this code in t.js to remove the automatic ajax links:
$(document).bind("mobileinit", function(){
$.mobile.ajaxEnabled = false;
});
and my new head html code is now:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/t.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
… the jQuery Mobile does load up but the "inbox" link still generates a 404 page by CI.
UPDATE 3: I determined it's a problem with something local. When I upload the CI code and the new jQuery Mobile scripts to my web server, the tab linking to my inbox.php controller does in fact work! Does anyone know why it doesn't work on my local machine using MAMP? Now, it appears that I can't develop and test locally with this configuration. Is there a fix?
Looking at allowCrossDomainPages at jquerymobile.com/demos/1.2.0/docs/api/globalconfig.html I added $.mobile.allowCrossDomainPages = true; to the jQuery initialization but it did not help the localhost server running MAMP serve up the inbox.php controller - still 404.
UPDATE 4: PROBLEM SOLVED. It turns out there was a problem in the hidden file .htaccess. To rewrite the URI, it contains a "RewriteBase /myapp-mobile/"; this directory became incorrect when I moved it over to the new folder under htdocs.
As per the documentation:
Working with jQuery Mobile's Auto-initialization - Unlike other jQuery projects, such as jQuery and jQuery UI, jQuery Mobile
automatically applies many markup enhancements as soon as it loads
(long before document.ready event fires).
And...
ajaxEnabled (boolean, default: true): jQuery Mobile will automatically handle link clicks and form submissions through Ajax,
when possible. If false, url hash listening will be disabled as well,
and urls will load as regular http requests.
Looks like it treats all links as ajax requests unless you specifically set that option to false within the mobileinit function, which you don't yet have.
Use this function below to force jQuery mobile to treat all links as normal http requests.
$(document).bind('mobileinit', function(){
$.mobile.ajaxEnabled = false;
// other options to enable on intialization
});

Why won't Joomla render my jdoc tags on the frontpage?

We just migrated a client from their server to a cloud solution. We moved their Joomla 1.5 site with little issue. The databases were migrated with ease. We had to clean up a few stray 'localhost' database connections. All seemed well and good.
Except the front page. Which for some odd reason refuses to render jdoc tags. At all.
The following HTML is currently found when viewing the front page of their Joomla install:
<!DOCTYPE HTML>
<html lang="en-gb" dir="ltr">
<head>
<meta charset="utf-8" />
<jdoc:include type="head" />
<jdoc:include type="modules" name="header-scripts" />
This is the only page that has this issue. All other pages on the site render jdoc tags correctly. My google search of this problem seems to end up with most people having the opposite issue: the front page renders fine and the other pages do not. There seem to be other related issues when dealing with newer versions of Joomla, but I cannot connect the difference in code between them, especially as Joomla 2.5.x uses a completely different approach to building the pages.
Any suggestions on how to fix this?
Notes:
Joomla 1.5
MySQL 5.1
PHP 5.3
Was running on a dedicated server, now running on a cloud server
This is my first foray into Joomla, and I am not impressed.
using YOOThemes as the templating engine (I have read something that this may be the issue, but I have no clue how to fix it.)

Facebook button for Ajax Pages, how to implement and verify that it works

I wanted to know how can I use Facebook Like button on my Ajax web application, that will capture changes in the Open Graph tags for both the og:title and the og:url. I already created a Facebook app and got an API ID.
What I want to know is the code that I need to put on my website in order for Facebook to capture the changes that I've made to the meta tags which contains that title and url information (ie. og:title, og:url).
I followed the instructions on Facebook without success. Furthermore, I want to know how can I locally test the Like button to see that it grabs the data from the Open Graph tags properly.
Also worth mentioning that I've a JQuery code that automatically alters the Open Graph meta tags to include the relevant information for the current Ajax changed page.
Thanks.
You will need to have a separate url for each different page that you want to allow people to like. I would recommend actually pointing the like button to the physical pages you're trying to return via the og:url tag. To refresh the data that Facebook stores about a given url, pass that url into the linter at http://developers.facebook.com/tools/lint.
i created a rotator file for facebook share on my dynamic ajax website.
rotator.asp code sample:
<html>
<% lang=request("lang")
id=request("id")
..some sql to get data...
ogTitle=....
ogImage=....
originalUrl=....
%>
<head>
<meta property="og:title" content="<%=ogTitle%>" />
<meta property="og:image" content="<%=ogImage%>" />
.....
......
<meta http-equiv="refresh" content="0; url=<%=origialUrl%>" />
//dont use redirect.. facebook dont allow 302...
</head>
<body></body>
</html>
for example xxx.com/#!/en/153 page will share xxx.com/rotator.asp?lang=en&id=153

Resources