Magento Block not rendering/Instantiating - magento

I created a custom block (by creating a module and doing a layout update via an xml file), and the block is not rendering for some reason.
I have commercebug installed so i checked the layout xml for the page and it shows that it updated with the proper info, but when I go to the blocks tab it's not there (and not calling it)
this block rendered nicely on my local machine but on the staging server it doesn't work (even though i copied the files etc.)
I am a beginner so any help would be greatly appreciated.
Thanks in advance,
pesach

It sounds like you're saying you've successfully added some Layout XML to the page layout. If you could post that it would help people debug your problem better.
The next three steps to take are
Ensure your block type is correct
Ensure your template file (if you're using one) exists
Ensure the block you're inserting your custom block into will automatically render blocks (i.e. is a text_list block)
If you post the actual layout xml you've added the page layout, we'll be able to help with the items above.

Related

Flushing the templatecache programatically

we have some sites running Umbraco9, where we have a few templates that are updated by outside developers. We are hooking up to an FTP and downloading their templates (.cshtml), and in backend their editors can choose from these templates to be inserted in a partial.
var setting = JsonConvert.DeserializeObject<CustomTemplateSettings>(Model.Value); // Getting the settings
thetemplate = setting.templateName;// Getting the selected template
showContent = _service.TemplateExists(thetemplate, forcereload);// Checking the selected template exists (physically), possibly downloading it to server
thetemplate = "/Views/CustomViews/" + thetemplate; // creating the path to the template
//Calling template - with some data
<partial name="#thetemplate" model="Model as ContentStructureField" />
Everything is great.... until they want to update their templates. Umbraco has them cached, and I need to either recycle App or hit save on a random Document Type in settings.
I have tried different things, like using #Html.Partial, #Html.CachedPartialAsync, using the tag. I cannot find a way to affect the lifespan or refresh the content of the partial
All googling results in explanations on how to cache specific content. And most Umbraco 9 specific documentation seems to have been lost with the emerging of version 10/11
I need some way to refresh the cache like when saving Document Templates. I do not care about the momentary effect on website performance, as the updates can be planned by the external developers to be non-peak hours.
Thanks in advance
Cannot figure out how to delete the question....
Turned out, that I had constructed the path to the template with a double slash ("/Views/CustomViews//TemplateName.cshtml")
While rendering engine did manage to handle this error and show the content apparently the cache did then not properly subscribe to changes to the file and kept the cached version, requiring a complete flush. Fixing the error in the path made the issue go away.

File persistently cached in Yii despite overwrite

I have this weird problem with one of our file. It's named Setup.php and stored under protected/components/
This file is mainly for emails, header, footer generating functions etc. We found out few days back that when we changed the footer layout in this file, the old footer would still show, despite doing a lot of debugging and edits (even removing the footer function itself), it still shows the old one. This is a shocker. I'm aware of cache issues but does Yii cache the whole PHP file? Is this even possible? We are positive the footer used the same function from the same file.
I'm again having this issue with another function in the same file. Determined it's a problem with the component file and Yii, I would like to seek assistance from the Yii users.
Please let me know your thoughts. Thanks in advance.

How to evaluate problems in the <head> of a Magento-project

I have problems with the setting of setRobots() in Magento 1.7.0.2 as I do set those in the backend via the XML-Update AND via the local.xml and though my cms-pages don't get the correct robots-tags. (the same btw also for description or other tags in the head-section)
I do know how to debug the visible parts of the frontend by activating the show-blocks in magentos' backend. But for the head-section that practice doesn't guide me no where. What starting point would be generally recommended to evaluate problems in that section?
Thanks
Like often, maybe a cache problem. config data is stored in cache and block rendering too.
Then you can edit the template at app/design/frontend/{package}/{theme}/template/page/html/head.phtml and/or the block linked app/code/core/Mage/Page/Block/Html/Head.php
Check the Mage_Page_Block_Html_Head::getRobots() method

Jenkins UI customization

I want to change the look and feel(ui customization) of Jenkins. Also I would like to add new views(say like new html pages or web pages) with navigation to the required jenkins pages etc.
Please let me know if any single plugins will help me to do so.Any relevant information(how ever generic) will be very helpful.
Any suggestions or links or tutorials is also appreciated.
PS:- Pretty new to jenkins.The inputs from here will help me to add more details to the questions.
I am looking for documents or tutorials that specify Skinning Jenkins using plugins like :-
https://wiki.jenkins-ci.org/display/JENKINS/Simple+Theme+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/jQuery+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/jQuery+UI+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/JSWidgets+Plugin
The plugin page is providing very little information on how to use these and the benefits and the extend to which the UI can be changed.
Any doc or link is appreciated.
Assuming you don't want to write a Jenkins plugin, for adding pages, the best suggestion I can make is to use an HTTP proxy such as NginX, and configure it so that the pages you want to add are plain html files, and Jenkins is proxied for the rest of them. To a visitor, they will look like they are all part of the same site; you could copy code from the head and body sections of Jenkins-served pages to include some of the navigation.
The Simple Theme Plugin, which you found, will let you do basic customization of the look and feel of Jenkins. I do that for my build server and proxy it using this configuration fragment for NginX. The relevant CSS is in this CSS file - toward the end, look for the // JENKINS CUSTOMIZATION comment.
We use the Simple theme plugin - pointed at a css file for the simple styling, and a JS file to fix a couple of DOM oddities (some of the tables in the new look and feel have mismatching column counts).
Those two files need only be hosted either a handy http server, or you can place them in usercontent.
You need only refresh the page in the browser to see the changes. Both files can then happily reference other files served up too.
Handy things to note:
Jenkins has jquery, parts of YUI loaded and prototype loaded - so you can use them in your scripts.
If while debugging, the refresh gets in the way then use the console to enter the following to temporarily stop it without pausing JS: refreshPart = function() {}
When making DOM tree changes to content that is refreshed - attach it to the layout updates with:
layoutUpdatecallback.add(my_function) - that way your changes are applied to new incoming content.

How to place a banner on webpage with one application to all pages of a website

How can I place a banner on webpage with one application to all pages of a website?
One way of doing this is to put your banner into a file, then include that one on each of your other pages. This way, you only have to change the code in one place to update the banner site-wide.
So, a PHP example would be:
banner.inc.php:
<?php
// echo out banner here...
?>
Then, on your other pages:
include("banner.inc.php");
You can just create a header file that you include in all your pages, and include the banner code in it. The solution is pretty much the same in all languages. If your host allows server-side includes, you can even do exact same thing with (nearly) pure HTML. You can also do it with JavaScript pretty easily.
Do you have a global template for all your pages? Something where the basic structure of all your pages is defined while the specific stuff is filled into parts of the body? If you had something like this you could modify the global template to have the banner you want and it would show on all your pages.
Google "html templating" for more.
I recommend using master pages. That way if you have something that has to be changed globally across the project you only have to change it in one place. And they are really simple to use.
If your web server is IIS, and you know a smidge of CSS you can do this without perl, without touching any other files, but at the cost of some performance.
IIS allows you to insert an HTML snippet into anything served:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e27f918e-89a9-45a8-8604-2ad2ded09d64.mspx?mfr=true
If said footer file, had CSS which shoved it to the top, then you would get the behavior you are looking for.
Please note, that this is NOT an ideal solution, but it is a quick and dirty patch until you can go back and retrofit all of your pages with a master page or something similar.
If it really should be on every page of your site, I'd argue that it's part of the site design rather than the content itself. In this case, you are easily justified in setting a background-image in your css. Of course, you probably then still have to have some sort of place-holder element in your html, but at least you could update the whole site together.
Well, hopefully you would have designed the website so that if you need to change something globally, you can just edit a header or footer file.
If not, I would use Perl to go through all the files, and do a search and replace.

Resources