i have add my region to a info file:
regions[mine] = Mine
then i have created a view with a block display and I add this block to my custom region.
Last, I invoke in my node.tpl.php with:
print render(block_get_blocks_by_region('mine'));
but I have a blank page with html:
Please any help??!!
Why are you invoking that in your node.tpl.php file? This doesn't make any sense in the context. It appears that you want to have a block inside of a region - this is configured in the administration pages, not theme files.
If you are getting a totally blank html page rendered then you likely have an error in your PHP somewhere - Drupal has a habit of swallowing PHP errors without any visible warnings.
Related
I have created a basic page in drupal 7 to use as my 404. I configured under Configuration -> System -> Site Information to use this page and when an unknown URL is entered, it does indeed display this page while maintaining the unknown URL. For SEO purposes, I really want Page Not Found in the html title tags but it is missing. If you go directly to the basic page, the title tags are correct. Is there a setting somewhere that I am missing?
I used the metatag module's configuration for the 404 page to achieve the desired title tags
When you create a any page, you will get node id of the respective page.
In your case, you need to copy page.tpl.php file and rename new file with your node id like for example : page--node--1.tpl.php
Now, put below code in your newly created template file and clear the cache.
if($title) {
print $title;
}
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).
i'm using the twentytwelve theme and i have to write custom content into my example template.
I want to maintain my header content so the main structure is the following
header = id page, wrapper
ex.page = primary, content
footer = close wrapper, close id page
If i have understood correctly, if i want to insert content into the middle of my page i have to do it into my template page (that is a copy of the main page.php), that is in the middle between my header and my footer
For example i want to insert a div into which insert the loop of such category.
The problem is that it displays me nothing, like i've wrote nothing. I can only see the contents if i erase all the originary div, but it's not what i want to do, just because the only div is the page which is my container.
I can't catch what i have to do.
Can you tell me what i forgot to do?
Thanks,
Alex
page.php is a "master" document. header.php, footer.php and (if it exists) sidebar.php are all imported into page.php. Twenty Twelve also uses atomized content templates. You may need to add your div to content-page.php, which is also imported into page.php. content-page.php is used inside the wordpress loop, and encapsulates the code that pulls in the actual article elements from the wordpress database.
If you are trying to add straight HTML to the templates, ensure that you are not adding code between the php brackets:
<?php // don't add html here ?>
<div>do add html here</div>
Depending upon the type of wordpress page you are trying to display, you may need to consult the Wordpress Template hierarchy to determine the proper Wordpress naming convention for your template file (the copy of page.php).
Technically speaking, everything in content-page.php can be put into page.php replacing the get_template_part function. All the 'content' pages are totally not required and can be combined into one file if you want simplicity.
In my opinion, it's easier to start from scratch when learning Wordpress rather than try and re-work something. The default wordpress themes don't lend themselves to be beginner friendly.
I am using WordPress 3.2.1 ,
Page template selection drop down is missing on Pages (Add,Edit)
wp-admin > Pages >Add New > Page Attributes
I Edit the Template Page Default page as below code
/*
Template Name: New Template
*/
But still the template drop down no visible , my older version of WordPress it display by default.
Following is the screen shot for more idea
I solved this problem solved by adding the typical following code:
/*
Template Name: Custom
*/
Don't add any spaces after Name:
It'll work if you use template name: as well.
It might help someone: check if your index.php file is in place.
If it's not there, wordpress treats the template as corrupt and it doesn't display the template selection.
This should be simple to troubleshoot. The requirements for the page template to work are straight forward:
The template needs the page title in the top of the file like you've shown (the title needs to be wrapped in a PHP tag, you probably just didn't add it with your example bu I want to make sure you havne't overlooked it):
<?php
/*
Template Name: Custom
*/
?>
The second requirement is that the file is in the root of the theme folder.
With those two requirements in place, it should work. If it isn't working you nave a few possible issues. I list a few off the top of my head:
You might need to re-install WordPress in-case a file was corrupted
during your last update.
It's possible someone has altered the WP-Admin layout using users
roles.
That's all I can thing of at the moment, let me know how it turns out.
I had the same issue. It actually turned out to be a missing style.css file within the template directory in my case.
This happens because the get_post_templates() in class-wp-theme.php first checks for errors. If it finds any then it returns an empty array (no templates are displayed).
A side effect of this is that saving a page would clear the existing template and use the page.php instead.
So in short if the errors() method of your theme returns any errors then no templates dropdown.
hope that helps someone.
Same issued, I found out that in appearance panel in your WordPress dashboard the stylesheet is missing. You shouldn't rename the style.css in your theme folder.
Not sure if this will help anyone, but we solved the problem by disabling our theme and re-enabling it again. We had some other theme folders in the theme directory that we weren't using so we deleted those out as well. good luck, it's a really random problem to solve!
yeah!template dropdown not showing because you have no template So how to solve this::---
1 create template folder in theme
2 create a template in this folder
like:-
<?php /* Template Name: Home */ echo "template"; ?>
and check-in page dropdown will be there.
I added a new region line to my .info file under /sites/all/themes/[theme] directory. However when I look at the Blocks page, the region is not visible, nor is it a selectable item from the dropdown menus. I've cleared the cache as well. What am I missing?
If you have multiple themes enabled, make sure you are looking at the correct theme on the block configuration page.
For example, if you have custom_theme and garland enabled, there is a block configuration page for each.
Go to http://www.example.com/admin/build/block/list/custom_theme to see blocks for your custom_theme
Go to http://www.example.com/admin/build/block/list/garland to see blocks for the garland theme
etc... for all enabled themes
When you say you cleared the cache, are you actually referring to the Theme Registry? Or did you really clear the database cache? If you just cleared the theme registry, it won't reflect the changes to the theme's .info file. You can clear the cache by...
Use the "clear all cached data" link or button located at "Administer > Site configuration > Performance".
With the devel block enabled (comes with devel module), click the "Empty cache" link.
Simply visit the theme select page at "Administer > Site building > Themes".
List from Drupal.org
It's also possible the browser itself is caching pages. You could clear your browser cache, as well as the Drupal cache, just to be absolutely sure.
If none of that works, could you post your region assignment from the .info file?
I'm presuming Drupal 6 here, but in your andytheme.info, did you add the region like this (look at the bottom line):
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
regions[andyregion] = Andy Region
Remember that you have to add all the regions if you add any in your .info file--they won't be inherited from your base theme.
And, in your page.tpl.php, did you add the region variable to be printed somewhere? Something like this?
<div class="region andyregion"><?php print $andyregion ?></div>
Of course, it would be surrounded by whatever and other stuff you'd want. Then flush the cache and see if it's in the blocks.
Andy-
The following assumes you use Zen as the base template.
Open up /sites/[yoursite]/themes/[yourtheme]/[yourtheme].info file and scroll down to where there are loads of regions[xxx] = yyy
The name in brackets is the machine name of the region. The text after the equals sign is a descriptive text used on the admin/structure/blocks page.
Open up /sites/[yoursite]/themes/[yourtheme]/templates/page.tpl.php and adding <?php print render($page['MACHINE-NAME']); ?> where you want the region to appear.