Diazo: not style overlay windows in Plone - plone

I am upgrading to Plone 4.2 (from 4.0.1) and moving my theme product from XDV to Diazo.
A bug has presented where when i submit a form from an overlay to a custom page template, the resulting page is 'plain'. By 'plain' I mean the only visible content is the main content area, there is no plone nav, logo, none of the style sheets are present etc. There is an 'info' message passed to this page and that does get rendered at the top of the page (nothing is styled with any plone or theme styles though). It's like the target page is rendered outside of the Plone space altogether.
I have tried adding to my rules.xml and adding the corresponding ajax_load = python: request.form.get('ajax_load') to the parameters in the theming control panel 'advanced settings' section. The overlay is still themed however, and the form target page is still 'plain' (I wont say 'unthemed' as even an unthemed Plone page still has the basic logo, nav etc).
I also tried add a and sticking an item with this id in my overlay template - the overlay still gets themed.
I am using the theme rule
Not sure why the overlays remain themed and if this is part of the problem? Also not sure why the form target page template is rendered 'plain'.
If i submit the same form normally (not from an overlay) the target page renders properly themed...
Any tips to debug this would be great thanks.
Am using Plone 4.2.0.1 and plone.app.theming 1.1a2, my theme is file system based.
Edit: OK some of my overlay forms are working properly. The difference seems to be where the form action is:
form tal:attributes="action request/URL" - works OK
form tal:attributes="action string:${context/absolute_url}/##view" - gives me the 'plain' page at first render when called from an overlay form (as discussed above is fine when called from the same form not in an overlay)
Note that the 'plain' page html goes like this (note no base Plone or Theme head inclusions):
<!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" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><base href="http://localhost:8080/Plone/sectionfoo/sectionbar/mypage" /><!--[if lt IE7]></base><![endif]--></head>
<body class="template-view portaltype-myCustomType site-Plone section-sectionfoo icons-on havePortlets haveLeftPortlets haveRightPortlets" dir="ltr">
<h1 class="documentFirstHeading">Why is this page plain?</h1>
...
I also tried completely uninstalling my theme product - i still see the same behaviour from these particular overlay forms in vanilla plone...

If you're using a JavaScript .prepOverlay() call to set up the ajax overlay, then it will automatically append the ajax_load flag as part of the query string used via AJAX to get the code that's displayed in the overlay.
See http://pypi.python.org/pypi/plone.app.jquerytools/1.5#ajax for an explanation of what ajax_load does. In brief, it causes the server to strip everything but the content area off. The purpose is to avoid loading unnecessary page parts into an overlay, which is already displayed inside a page.
If the form you load is posting to itself (a very common Zope/Plone practice), then the ajax_load parameter may be in the form action URL. So, you get only the content area returned.
So, you'll need to do some work in your custom form template to make sure you strip "ajax_load" off the query string of the URL before you set the form action. Also, strip any "ajax_load" hidden input out of the form.

Related

how do i locate files in wordpress by inspecting element a particular element in google chrome?

I want to change some particular line on my Wordpress site which I cannot change in the customization. How do I locate a certain line with inspect element in chrome?
My website is www.Artiana.io and I want to edit this line:
"<h5 class="subscribe-description">Learn more</h5>"
Please, can anyone help me out?
Let me show you how you can use WordPress's hints in html body class to find the php file:
WordPress gives hint in the HTML's body tag that which particular template was used to display this page.
In your case we have following classes in the body tag:
<body class="home page-template page-template-page-templates page-template-page_front-page page-template-page-templatespage_front-page-php page page-id-466 custom-background wp-custom-logo blog-post">
Now there is a specific class which ends with php, which tells that template was used by your theme to build this page. i.e. page-template-page-templatespage_front-page-php
Now it could mean that in your theme folder:
/wp-content/themes/hestia/
There could be sub folder or folders called: **page-template/page-templates** and inside it is page_front-page.php PHP file, which is being used to create this layout. See if you can locate the code you are trying to modify there.

Diazo - on error show message (when you get the content from a page)

Can we skip a diazo error and prevent page crash by replacing it with a nice message in page? Something like: Your content you want to show in this page is not created or published. Please check this section /source/homepage-content-sample-section.html.
<!-- Images slider section -->
<replace css:theme="[data-diazo='my-images-slider']"
href="homepage-content/homepage-images-slider" method="document"
css:content-children="#content-core" />
<drop css:content="#content-core [data-diazo='my-images-slider']" />
I have a page in Plone for each section in Homepage, that contains html code easy to edit. The problem is if a page is missing or private the homepage is broken.
Calling user-managed contents with href in a Diazo rule is like playing Russian roulette. If the page is not existing, there is not way to prevent the page crash.
The best approach is to call a developer-defined URL in charge of retrieving the content if it exists and that will just gently return nothing if the content does not exists.
Rapido is a very easy way to do that (you create a Rapido block which can be called like that: href="##rapido/myapp/blocks/get-content-for-my-homepage", this URL will always work, your page will never crash whatever the users have done with the content).

Custom background theme support not being applied

I've added theme support for a custom background to my WordPress theme, as below, but the background colour is not actually being applied (note that the options are showing correctly in admin though).
According to the docs "When the administrator sets custom values for the theme, WordPress generates an extra style sheet in-line with the HTML headers." However, this is not the case.
The <body> tag is declared as <body class="home blog logged-in admin-bar customize-support">, with the promised custom-background class neither declared in the header nor applied to the <body> tag.
Is there something I'm missing here?
Here is how I am adding custom background support.
$ps_background_defaults = array(
'default-color' => '000000'
);
add_theme_support('custom-background', $ps_background_defaults);
The problem was that I hadn't saved the custom background settings, and once I'd done that everything was fine.
This does seem like an issue with the core to me, as the default is ignored, and I am off to do some research on Trac now. I'll update with a ticket if one is opened.

Changing content in cufontext tag within a wordpress theme

I have installed a WordPress theme which features headings like 'our sponsors' or 'featured posts'. When I inspect the element using google chrome, it shows that it is within a tag called 'cufontext' which I have never come across before (i think it is to do with javascript).
Is it possible to change the content within the cufontext tag so that it says something different like 'about me' instead of 'our sponsors'?
Thanks
Cufon is a font-replacement technique that uses javascript to write fonts from a font file to your browser.
So those <cufon> tags are generated when page renders and are not in the template files.
Simply find where 'our sponsors' text is located and replace it to your likings.
The most possible location for that text is:
in post / page as a title
in the template as static text

showing categories wordpress in google result , HOW?

how are you?
this is my website: http://rehlat-world.com
when I search in google : site:rehlat-world.com
The result only "POSTS , PAGES , TAGS"
I need to include categories but I can't
this is example for category : http://rehlat-world.com/country/indonesia
=======================
The source of category page " " also it is include in sitemaps.xml http://rehlat-world.com/sitemap.xml
Please Help me how can include it.
Note I'm using this plugins (All in One SEO Pack و Google XML Sitemaps , WP Super Cache)
I can help you with your issue. This is an easy error to make and thankfully just as easy to fix.
If you take a look at the source code of your category pages (right click anywhere on page, select link to source code).
On line 9 you will see
<meta name="robots" content="index, follow" />
This is perfectly fine but then if you scroll down to lines 74 - 80, you will see All in One Seo plugin has also added its metatags,
<!-- All in One SEO Pack 1.6.13.2 by Michael Torbert of Semper Fi Web Design[418,446] --> <meta name="robots" content="noindex,follow"/> <link rel="canonical" href="http://rehlat-world.com/country/indonesia"/> <!-- /all in one seo pack -->
So you can see the repeated "robots" meta tag specifying "noindex". Simply go to into your All In One Seo plugin settings and disable the option to add robots meta tags to categories.
Obviously the first meta tag is all you need.
This will do the job and cats will be indexed in no time.
I will also add a suggestion that will help your site in the future by making it more appealing to your visitors and the search engines. I looked in your sitemap and noticed your permalinks are extremely ugly due to the Arabic text being used, which inturn cant be recognized by wordpress or the browsers because you still have wordpress set in English. You should really change your wordpress language config to Arabic.
The very first line in your source file says <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Strict//EN tells your browser the website is set in the English language and thats how the internet browsers should read the website. You should be able to fix this by adding in the header.php file of your theme, above the tag. I think this should work but im not 100% sure and may be wrong.
You also edit your wp-config.php file and find define ('WPLANG', '');, change that to define ('WPLANG', 'ar');. I have very little experiance with this so it would be wise to read http://codex.wordpress.org/Translating_WordPress#WordPress_Localization_Repository
could also save you time to do it with a plugin like http://wordpress.org/extend/plugins/gtranslate/
If you are already well aware of this and its not causing any issues with your rankings, disregard what I said.
Good luck
Aaron

Resources