How do I override the theme_table() function of the Drupal core in my theme? I just wrote another function named theme_table() in my template.php file, but the default theme_table() is still in effect.
It sounds like your template.php file isn't being read, because having two functions with the same name should trigger an error. Try renaming your theme_table() function to THEMENAME_table() (where THEMENAME is the name of your theme) or to phptemplate_table().
If that still doesn't work, try clearing your theme cache.
Related
Is there a way to remove default.css and /colors/default.css from a page with a web form for marketers form on it using sitecore?
I have found a few places suggest simply deleting the file, but then it is still outputting redundant code. I don't want to simply delete the contents of the file for the same reason.
I have found the forms folder in sitecore with the standard values seemingly telling the form to import default.css, but if I change it to blank or even another file, default is still there and nothing else shows up.
You can open static method Sitecore.Forms.Core.Configuration.ThemeManager.RegisterCssScript in Sitecore.Forms.Core assembly via reflector. It seems that there is no simple way to remove adding this style reference.
You can remove this link in OnInit or OnLoad events handling as workaround.
So I have a parent layout called "font.php" which is located in "protected>views>layouts". What I would love to be able to do is to add PHP code at the top of this file so that all subsequent child views can access it.
I've tried declaring globals but they do not work, I've also tried define() and that does not work. Is there a simple way to achieve this.
Thanks.
Inside your both layout and view you have $this, which is instance of current controller. The simpliest way is to add some properties to controller and access them from layout and child views.
Regarding a global variable in your layout file, the short answer is no. Your layout file wraps the view file after the fact, it isn't called before hand.
I would like to pass data such as navigation items or languages supported to the portal_normal.vm file so that it gets displayed on the portal.
I don't have a clue about how to do it. I've seen that in velocity files the data is passed in variables as follows:
<title>$the_title - $company_name</title>
I would like to do the same for navigation items and other data in my portal but I have no clue how.
Liferay's themes have a file called init.vm - this initializes quite a bit of the data. If you don't find it in your theme, it will be loaded from the _styled or _unstyled theme that you can find within the portal (or the portal source).
You can also look at the Java side of the equation: There's a class called VelocityVariablesImpl, this initializes "the other" variables in the context.
In addition, you can have a file named init_custom.vm in your custom theme, where you can add more initialization. This file is meant to be empty in default themes, but as it's included and evaluated, you can add your custom variables and initialize them in here.
Is it possible to create a layout file inside of a module ? How ?
For what:
I want to add a some kind of statistics hit counter for products, and I don't want to override the products class, as that is already done by some module I'm using. Thus I thought it would be best to have a custom module with a block that would be called by a layout statement.
Of course I could easily edit my private local.xml or make changes to another layout-xml in the layout folder of my theme, but I want this feature to be available in all themes (independent of any selected theme).
Some constraints:
All code in one single module
... so that it is theme independent
... so that the module can be shared with others without them having to change anything (like theme files), so that the install/load of my module would be enough
I would also accept different approaches for my statistics hit counter loading (using the same constraints)
Yes it is possible. Just create your layout xml file in the following path: /design/frontend/default/default/layout/yourlayout.xml(or whatever your theme name is), and add a proper statement in your modules etc/config.xml:
<config>
<frontend>
<layout>
<updates>
<yourmoduleshortname>
<file>yourlayout.xml</file>
<yourmoduleshortname>
</updates>
</layout>
</frontend>
</config>
This sample is for frontend user, but adminhtml layouts can be updated in a similar manner. If something doesn't work, be sure to check if your layout is in the proper theme/package directory.
Edit:
Second approach:
You can use a controller of your own, which will extend the core functionality (one of the catalog controllers) - just rewrite it (or just product view action). Inside its action method add something like this:
$thiss->getLayout()->createBlock('namespacename/block','layout-block-name',
array('template' => 'relativepathtotemplate.phtml'));
$this->getLayout()->getBlock('content')->append($block);
run-original-parent-code();
Third approach:
Similar to the previous one, but you can use some event observer, and try Mage::getSingleton('core/layout'), and inject your block there. Not in all events the layout will be already available (try the post_dispatch family).
I don't really recommend the second and third approach, because if someone else wants to find where this 'magic' block comes from, it will most surely look int app/design/(...) directory. Finding it in your controller or model, may be very tricky...
If you don't want to display your statistic counter, you can also use events (like post_dispatch) to count the controller dispatches. Just create an observer attached to it, and store your data in the DB.
I got this warning in title when I built the app to device(iPad).
And the Mainwindow has : object, Files owner, first responder, view controller and window.
Can anybody help whats the matter?
Yours
Miska
The thing happens when you have two declarations in defferent xib files. For example you delete TextController.xib file, but declaration stil exists. And you can see ie in your Interface builder.
Just take a look on you View Controller "Loaded from TextController.xib". You can delete the declaration and create new one. It should help.