I can't seem to use a unique page--xxxxxxx.tpl.php for a specific page.
I created a "page" content, filled it in, and gave it a path alias. Let's say: "mypage/mycontent". Then I created a page--mypage--mycontent.tpl.php file in my theme's root. Instead of using it, my page.tpl.php is being used.
I was under the impression that Drupal 7 automatically searches for template suggestions using the format of page--path.tpl.php, is this incorrect? Do I need to include specific code in my template.php file first? I did try clearing the theme cache, btw and that didn't make a difference.
If it's just a node, try to rename your template file to page--node--NID.tpl.php and then flush the cache, also don't forget to replace NID with the nid of this node to be something like page--node--11.tpl.php :)
Hope this works... Muhammad
Your impression is correct, and page--mypage--mycontent.tpl.php (i.e. the one you've already tried) is the correct file name to use to override the page.tpl.php for a page with that specific path "mypage/mycontent". You don't need to change anything else.
However, in addition to clearing Drupal's cache, you also need to clear the browser's cache. In most browsers, including Firefox and MSIE, you do this by holding down the SHIFT key while reloading the page. Without clearing the browser's cache, you will not be able to view your template suggestion in the browser.
Related
I have problem after using all-in-one wp-migrate. I export page to other domain and then I have problem with include css and js files in personalization page. This files have wrong url, becouse there are "/wp-content/plugins":
For example(there are about 50 links like that, with css and js files):
There is:
/wp-content/plugins/wp-content/themes/classiadspro/includes/framework/ReduxCore/assets/css/redux-admin.css
Should be:
/wp-content/themes/classiadspro/includes/framework/ReduxCore/assets/css/redux-admin.css
I can't find where are generate this links. I think it's something wrong with some function file, but I can't find it. Please help where I can change that.
You should regenerate permalinks after migration using All-in-One WP Migration. On the left side menu, select Settings > Permalinks, then click Save Changes. It’s unnecessary to edit any of the default permalink structure information. Repeat saving once again (twice at all) and now it should be ok.
I have a file structure like
example.com/mywordpress/ --contains WordPress
example.com/custompreview.php --preview getter outside wordpress
I am using wp-load.php to load wordpres and using its contents. I am able to recive published posts with no problem, I even know how to make query for previews but when preview get parameters comes to the script outside the wordpress folder (custompreview.php) obviously the wp-load.php calls exit and shows only access error message.
Example is worth thousand words:
example.com/custompreview.php?preview=true&preview_id=64&preview_nonce=1f2477c5d2&post_format=standard
Shows only message "You do not have permission to preview drafts"
What is causing this? What is the wp-load.php checking for? How to fix this? :)
If you are getting this while logged in -
the session cookie may be limited to the /mywordpress folder.
Unless explicitly specified, the cookie will be valid in the subdirectory it was set in (and all children).
I'm not sure whether it is possible to change WP's session cookie behaviour, but it may help to put the PHP file inside /mywordpress.
I know that there are other posts about disabling caching. I've read all of them that I can find and am still having a problem, so please be kind and don't kick me for starting a new thread.
Here's the deal, I am working on a site that a landlord can use to list all of their properties. It's sort of like an MLS based site that a realtor would use.
The problem that I'm having wouldn't be a problem for me, but it will be for my client who isn't very bright (I can say that, she's a family member). Once a property is set up and all of the various pictures are uploaded there is an option to edit any of that data as well as delete any of the existing pictures. If you delete a picture, all works well but the browser caching makes it appear as if nothing happened. Hit F5 (in Firefox) to refresh the page and everything looks like it should.
The problem has to do with how I chose to name the photos that are uploaded. The photos are renamed using the property address info with the number of the picture appended. For example: 3505Cardinalpic1.jpg, 3505Cardinalpic2.jpg, 3505Cardinalpic3.jpg, etc. If I were to delete the first one, for example, the following pictures are renamed to keep the naming order intact. They would be come 3505Cardinalpic1.jpg, and 3505Cardinalpic2.jpg, for example. Both surviving pictures are the 2nd and 3rd pictures from the pre-existing sequence of 3.
When the page reloads after one picture is deleted, it loads the pictures from cache because the filename didn't change, only the source file itself.
I figure that I could fix this by rewriting my php that handles the pictures so that the file name is appended with a timestamp or something that would make each name still recognizable but unique but I want to make sure there is no easier way to do that before I go in there and futz with something that's working.
I'm intentionally not posting code because I don't think it's a code issue and the problem description is already long enough. If you'd like to see a section of my code, just ask.
I've tried this with no luck:
test php disabled caching
I've tried appending my url with a timestamp to make it unique and that didn't help either.
Thanks in advance for any advice.
To force the browser to not cache the file, link it with a changing parameter. If you do that :
<img src="3505Cardinalpic2.jpg?001"/>
and just after, that
<img src="3505Cardinalpic2.jpg?002"/>
the browser will reload the image because he is not sure this is the same. If you want never caching, you can put a timestamp as parameter.
But it's not good to disable caching, so maybe you can change the value only when there is a modification in your album ?
I'm quite new to Drupal and want do some editing of the header. I want a custom toolbar to appear on every page. I've already created that toolbar in a file called toolbar.php. It has a layer which is fixed and will appear on top of every page.
How do I include the toolbar.php in the header template of drupal?
The toolbar refers to $user which is a global Drupal variable and I want to test toolbar.php before publishing it to the site. Is there anyway I can do that?
Regards,
Dasith
Of the two methods above the first is easier if you understand the basic idea of html and CMS templates, the second will be easier if you are a programmer.
First thing to check is that you really need to do this! Can't you restyle one of the existing menus (Primary or secondary) to do this - will make your life (and anyone who works on the site in the future) a lot easier.
The other thing you can do is look into adding an output region, basically something where you put the php into a drupal friendly format and then effectively do a 'drupal print'. This is how the toolbar, search box etc are done. You still need to alter the templates as above.
Yes for sure. If you want to have the html produced by your function/file appear on every page of the site then you will need to over-ride the page.tpl.php file in the theme you are using and essentually add the html to that file.
To gain access to the $user variable, just declare it in your script.
global $user;
open page.tpl.php file in a code editor and save as page-front.tpl.php (with two dashes if you are using Drupal 7.. one dash with Drupal 6) and upload it to your theme's directory. Clear your cache by going to configuration->Performance->Clear All Cache. Then referesh the page. Now your homepage is using page-front.tpl.php as it's template file. Every page will need its own template file. The page machine name comes after the hyphen so the user page template uses page-user.tpl.php. You can edit it as you want. The proper way to really do this is to use hook_theme() to pass variables to the template file. One variable could be the html which creates your custom header.
See also http://drupal.org/node/457740 Beginners Guide to over riding theme output
I am new to SMF.
I just installed SMF on my website. I tried editing the index.template.php . After saving changes, it displays raw HTML and PHP on the browser. I tried fixing the prob by returning the the page back to the original state to no avail.
At the moment, everything is gibberish both frontend and backend.
Pls what do i do?
There should be at least an open tag at the top of the file (at the top of every .php file). Make sure you didn't remove this tag. Everything outside of a <?php is interpreted as normal text so if you have removed this it would explain your issue.
Also, being an ex-team member for SMF I can assure you its better to create a copy of the default theme, then make your edits to that theme. Then if you experience an error you can always pass a param in the url to reset to the default theme (in case you need to get into the admin area). To do so end the url with index.php?theme=1