Questions tagged [static-block]

A static block is a normal block of code enclosed in braces, { }, and preceded by the static keyword.

166 questions
0
votes
2 answers

How to display for static block pages for magento1.9.0.1?

i created staticblock pages in admin panel(magento ver1.9.0.1),but while creating pages the storeview tab is missing..so,i'm unable to create a layout for my staticblock pages.please check the image below:
heart hacker
  • 431
  • 2
  • 8
  • 22
0
votes
1 answer

Static block executing after entering main method

I have a class where i have my main method from where i am calling two static getter calls of singleton pattern. That is, i have 2 classes which have static blocks and have getters for each of them. The following is for reference. public class…
user3592502
  • 325
  • 1
  • 5
  • 18
0
votes
1 answer

Force static block to be executed before start() method

I am using JavaFX for my project and I have two classes - MainApp class and Database class. Very simplified implementation would look like this: public class MainApp extends Application { @Override public void start(Stage stage) throws…
FanaticD
  • 1,416
  • 4
  • 20
  • 36
0
votes
1 answer

How to include a phtml file in static block magento 2?

Can somebody help me in finding How to call a phtml file in static block magento 2? I am new to this, can you please give me full documentation for this as how to do this.I have searched and read whole stack but I couldn't understand. The earlier…
Rajat Gupta
  • 1
  • 1
  • 2
0
votes
2 answers

how to get current skin url in magento?

I am using Magento 1.9.2.4. I am using static block for my custom themes and i give the path for images but it's return…
bansal kapil
  • 445
  • 1
  • 3
  • 13
0
votes
2 answers

What is difference between static block and static field?

I looked this issue and I am confused. He uses a static block. Why would he write a single line? What is the difference between these two? private static Pattern email_pattern = Pattern.compile(EMAIL_PATTERN); And private static Pattern…
cguzel
  • 1,673
  • 2
  • 19
  • 34
0
votes
0 answers

static block is not executed when i read one more field from file

I am reading some path from xml file in static block. I have read one field from xml file and it was succesful. When I try to read second element from the same file, static block is not executed. private static String path1 = ""; private…
user1474111
  • 1,356
  • 3
  • 23
  • 47
0
votes
1 answer

what is the difference between Initializing a static object inside static block and outside?

What is the difference between below two codes? Class A { private static A obj; static{ obj= new A();} } and Class A { private static A obj=new A(); }
Vipin CP
  • 3,642
  • 3
  • 33
  • 55
0
votes
1 answer

Over riding the static block of a class in java

I am trying to extend the functionality of the driver for some device. I don't want to change the code of the driver but I want to add the functionalities by extending the existing code for drivers.The driver class has the static block where it is…
Talib
  • 1,134
  • 5
  • 31
  • 58
0
votes
0 answers

Java - what's the difference between singleton and static-block-based classes initialization?

Recently I learned Singleton pattern. And had to realize one. For example: public class Singleton { private static Singleton instance; private InnerObject innerObject; //all functionality is here private Singleton() { …
0
votes
2 answers

C++ Idiom for executing arbitrary code before main in arbitrary translation unit

I have one translation unit with my main() function and another TU without main. Suppose even that I only control the second one and can't touch the first one. Now, for reasons I will not go into, I want to be able to run some code before main()…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
0
votes
1 answer

Throw checked Exception from static block

i want to throw checked exception from a static block, when i tried that the following compilation error arises: error: unreported exception Exception; must be caught or declared to be thrown my static code block is as…
Eslam Hamdy
  • 7,126
  • 27
  • 105
  • 165
0
votes
1 answer

Magento Static Blocks not showing after site migration

I just migrated a website from LIVE to my Local system. After migration, the site seems to be working fine however the static blocks are not appearing anywhere on the website. They do exists in admin section, I also tried adding new static blocks…
Nasir Zia
  • 564
  • 1
  • 6
  • 20
0
votes
1 answer

How can I add a unique second static block to every category page at the bottom? with magento

I want to add a second static block to the bottom of every category page in my magento 1.9 store. Like this site I want a description on top of the products but also a larger description at the bottom. I am very familiar with magento and hard…
BG media
  • 1
  • 1
0
votes
2 answers

Could not initialize class com.example.testapp.SomeHelper

public class SomeHelper { ... private int static x; static { Map aMap = new HashMap<>(); //populate map here } public static void setX(int value){ x = value; } } When SomeHelper.setX is…