How do I name a drupal page template file according to a node's url path setting? - file

I'm new to drupal and having trouble naming a page template file. In drupal 7, let's say I've created a basic page with the url path as:
www.example.com/my-page
When I create a custom page template file, I've been able to get the file name page--node--[nid].tpl.php to work fine. However, I have 3 different sites (localhost, development, and production) and each has a different node id for this page (because the databases aren't sync'd). I need to find a way to name the template file according to the url path. I've tried all of the following, none of which has worked:
page--my-page.tpl.php
page--my_page.tpl.php
page--node--my-page.tpl.php
page--node--my_page.tpl.php
Any suggestions?

Check out the theme developer module. With it you should be able to get a list of possible template names that are being considered.

Related

Issues in editing a Joomla plugin, cannot find files

I am unable to find this page in the Joomla files. I want to edit this table and place a link in every row in the table. This is a creative contact form plugin for Joomla.
The page link from the Joomla administrator is https://SITENAME.COM/administrator/index.php?option=com_creativecontactform&view=submissions
Thanks in advance.
If I see it right, it's not a plugin, it's a component. I assume that you want to change the view, not the database table.
You should find all the files that handle the output of these components in the directory:
JOOMLA/administrator/components/com_creativecontactform/views/
or for frontend in the directory
JOOMLA/components/com_creativecontactform/views/
The file you're looking for should be in the directory
JOOMLA/administrator/components/com_creativecontactform/views/submissions
Upate: You should not change the original files. If you like to change the output you have do create an override. See section Component Output Types and Layout Overrides in the Joomla documentation Understanding Output Overrides.

dnn - 2sxc - modules of a duplicated page / page template are using the same content

I created a page within dnn (v9.0.2, 2sxc 8.12.0) with all modules (only 2sxc content modules) like the page design had defined it. After this I created a template from this page. After this I created a couple of sites using this template.
My problem is, if I change the content of module A on page 1 - all modules A on the other pages 2..n of this template have this content now too. Same effect, if I use the duplicate functionality.
Does anyone have a hint how to use page temlating using 2sxc content modules?
What you need to do is open the template file in an editor and locate the section that describes the module. The best way to do this is to find the EntityId of the content item on the page from which you created the template. Then, find that number string in the template. Just remove the string, leaving the XML node otherwise intact.
When you build the page, you'll get a 2sxc module that is uninitialized and you'll need to specify the content.
If anyone is listening, I wish that this behavior was different. I'd prefer that the template assigned to the module could be preserved, but with the default content showing.
Basically the issue is that DNN has only one way to export a page, and we would need something where our code could contribute something before the export is complete.
At the moment there are two ways to do this.
One way is to use the method described by Joe, modifying the XML export
The other way is to place un-initialized blocks on the template page - meaning that you select your content-type / template, or your app, but don't start adding any content yet. This should result in the identical XML as the one modified manually.

Access base URL of main site in another site in Drupal 7

I have setup multisite in Drupal 7 and need to access theme settings and base url (test.com) of a main site in test1.test.com. How Can I do this one?
For example:
Main site: test.com<br>
Multisite: test1.test.com<br>
Multisite: test2.test.com <br>
likewise.
Folder structure:
sites/all/themes/testtheme/<br>
sites/test1/themes/custom_theme/test1<br>
sites/test2/themes/custom_theme/test2<br>
Thank you in advance.
I assume you should be using a different settings.php with a different DB for each sub-domain site, and in this case you can't access the variables of other sites into another site. However, there are two ways to get the main site base_url in other sites.
First, you could add a configurations variable through settings.php like $conf['main_site_base_url'] in individual settings.php OR the other way, if you are using a shared codebase, you can set this variable in custom module hook_init() or hook_boot() [whichever works with your setup] with this variable_get('main_site_base_url','test.com').
Once the confiuration variable set into the system you could get this using the variable_get function like variable_get('main_site_base_url','').
For inheriting the theme settings I would suggest to go with a sub-theme option as explained in this post.

Creating an index page automatically

I'd like to have dotnetnuke build an index page based on pages that have a particular tabid. Are there any modules that do this already?
e.g. we create multiple pages under /News and then the index page lists links to all the news articles. Would be handy if we could also enter our own HTML text (maybe on the News article page itself) that is then displayed next to each link on the index page.
Thanks!
By default, there are no 'real' pages in DNN. Everything is served up in the Default.aspx from content that is stored in the database.
What you could do is create a module that populates data based on the TabId or Path. Then, there is a setting in DNN to make a module appear on EVERY page. Since the module is on every page, it could populate its data based on the TabId or the path, or just not show anything if it doesn't match your criteria.
For something like that, I used a module called SQLGridSelectedView from www.tressleworks.ca (I have no affiliation) and I wrote my own SQL to fill in the fields, and I defined a custom layout (instead of the default data grid) so I was able to do something like what you are asking without code.
There is a module from Ventrian called Child Links that does what you are talking about. You can use it to grab title & description from the pages below a relative to a specific page to build out menus etc.
It allows for formatting however you want as well.

Custom page in drupal

hi i m new to drupal i want to know that how could i add my custom page for the display the some information which is come from databases, i have create that page in core php (for example information.php)but i want to add that page in drupal 7 how it is possible
looking for the quick and best reply
The quickest way would be to add a content type "Information" to your drupal site, rename your information.php file to node--information.tpl.php and use the Drupal Database API to get stuff from your database. Finally you'd want to put node--information.tpl.php in your theme/%themename/templates/ folder and add new content with the Content Type "Information".
The best way would be to make a new module. Build your menu structure and add a theming function that calls a template file. When calling the template file using theme(), pass along the data that needs to be displayed.
In addition you might want to check out the Custom Page module: http://drupal.org/project/custompage

Resources