Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

551.

How to load a view in CodeIgniter?

Answer»

You can USE this $this->LOAD->VIEW('name'); to load a view in CODEIGNITER.

552.

How to add or load a model in CodeIgniter?

Answer»

You can do it with this $this->LOAD->MODEL("ModelName");

553.

What is hooks and how we can configure hooks in CodeIgniter?

Answer»

It is a type of EVENTS which can be called before and after the execution of a program in CodeIgniter. For example Hooks can be used where we need to check WHETHER a user is logged in or logged out before the execution of controller.

It can be globally enabled or disabled by setting in the application/config/config.php PAGE

It can be defined in application/config/hooks.php page. In CodeIgniter each hook is specified like an array with this prototype:

554.

List the databases supported by Codeigniter?

Answer»

CURRENTLY CODEIGNITER supports these databases that's are GIVEN below :-

  • MySQL
  • Oracle
  • PostgreSQL
  • SQLite
  • ODBC
  • Firebird ETC
555.

What is Codeigniter & why it is used for?

Answer»

It is a PHP open-source WEB DEVELOPMENT framework which is used for building dynamic websites.

2. What is the LATEST version of Codelgniter? LISTS its new features.

4.0 is the latest version of the Codelgniter framework. This version is released on September 3, 2019.

Here are some new features that support Codelgniter

  • URL Helper
  • Query builder
  • Email Library
  • Form Validation Library
  • Session Library

Codelgniter updated these MODULES to enhance features.

Also Read: PHP interview questions
556.

What is the use of CTools in Drupal?

Answer»

CTools or Chaos TOOL Suite in Drupal is a project-oriented towards better coding for DEVELOPERS. It is basically a SET of tutorial classes that have been SIMPLIFIED to explain certain workflows meanwhile also defining some CUSTOM functionalities.

557.

What are the Databases Drupal supports?

Answer»

DRUPAL supports MYSQL, MariaDB, PostgreSQL and SQLITE.

558.

Explain the SEO modules available in Drupal?

Answer»

Some of the SEO modules available in Drupal that's are GIVEN below:-

  • Pathauto
  • Meta TAGS/ NODE words
  • Service Links
  • Google Analytics
  • Related Links
  • Search 404
  • Site map
  • Url list
559.

What is module and List out some of the modules used in Drupal?

Answer»

A Module is a collection of files which containing some FUNCTIONALITY and is written in PHP because the module CODE executes within the context of the site.

In Drupal some of the modules recommended here :-

  • Views
  • Token
  • Ctools
  • Quicktabs
  • Pathauto
  • Webform
  • Google Analytics etc
560.

What do you mean by PDO in Drupal and how to enable PDO?

Answer»

It is an acronym for PHP Data Objects. It is a lean, consistent WAY to access databases. PDO is just like a data access layer which uses a unified API.

To enable PDO, CONFIGURE --enable-pdo and --with-pdo-sqlite --with-pdo-mysql or whatever database NEEDS supporting by PDO

For windows users : For Apache, you will need to make sure php_pdo.dll and php_pdo_mysql.dll exist in the php/ext directory, un-comment or add the appropriate lines in php.ini, after that you have to restart the web SERVER. In windows it may no longer be required to enable PDO when using newer versions of PHP, PHP version 5.3 and later. It refers to php_pdo.dll. However, you still need to activate php_pdo_mysql.dll for MySQL or for WHICHEVER database you are using.

561.

Is Drupal is a CMS? Explain

Answer»

It is a Content Management FRAMEWORK, from which we can build a CMS tailored SPECIFICALLY for our NEEDS.

562.

List the system requirements for Drupal installation?

Answer»

Detailed system requirements for a Drupal 8 installation.

  • Websites built in Drupal 8 core are COMPATIBLE with, and fully FUNCTIONAL in, all latest browsers support CSS and JavaScript.
  • Database server to run Drupal 8
  • Drupal 8 works on WEB servers with PHP 5.5.9 or greater.
  • Detailed information regarding the PHP requirements for Drupal 8.
  • 32-bit PHP can only support a LIMITED range of dates.

For more detail you can visit its official website : Click here

563.

How do you disable commenting on articles in Drupal?

Answer»

To disable comments in DRUPAL 8, there are two parts.Using Drupal Admin

  • First of all, login to your Drupal admin area
  • Now, go to the Administrator tab, then Content tab and FINALLY click on the Content Types.
  • Now, click and edit the content TYPE you prefer to disable the comments for.
  • Lastly, you must ensure the comments are on ‘OFF’ mode by default

If you’re using Drupal 7.x/8.x use the following method to disable the comments:

  • Login to your admin area
  • Go to Structure -> Content -> Types ->Comment Settings
  • Select the option 'Closed' PRESENT under 'Default comment setting'
  • Save the changes
By executing an SQL query

Deleting/disabling the comments can also be executed by the SQL query in the phpMyAdmin. Here are the STEPS to follow:

Execute this SQL query in your database

UPDATE system SET status = ‘0’ WHERE filename = ‘modules/comment/comment.module’;

If you would like to reverse the effect, i.e. enable comments at a later stage, simply change the SET status = ‘1’

564.

How to create rest API of tab in drupal 8?

Answer»

To successfully ENABLE a REST API tab in Drupal 8, follow these steps:

  • Download and install the REST UI contributed module.
  • Now, expose the view data as rest export using Rest UI
  • Now, create a CSRF token for completing basic authentication procedures.
  • Now, submit files to the NODE using the REST API
16. How to create a custom profile in Drupal 7?

In Drupal 7, custom USER profiles are like fieldable ENTITIES similar to nodes. To create a new custom user profile, follow these steps:

  • First, GO the Administration
  • Then, go to the Configuration tab
  • Next, click on People
  • Go to Account settings and add a new field
  • Configure the corresponding display to each user page on the Account Settings (ie. /user/$uid).
565.

How to insert form data into the database in drupal 8?

Answer»

Here is a code to insert data from the FORM to the table in a DATABASE in Drupal 8

Example

public function submitForm(array &$form, FormStateInterface $form_state) {
$field = $form_state->getValues();
$name = $field['name'];
$email = $field['email'];
$field_arr = [
   'name' => $name,
   'email' => $email
];
$QUERY = \Drupal::database();
$query->insert('users')
   ->fields($field_arr)
   ->execute();
drupal_set_message("data SUCCESSFULLY saved");
}

566.

Which is the best module for implementing Search in Drupal 8?

Answer»

SOLR SEARCH MODULE

567.

How to add custom PHP codes in pages using Drupal?

Answer»

DRUPAL does not allow adding PHP code directly inside a post or in a BLOCK by default.
To do this, we NEED to activate a drupal module called PHP FILTER via Administer Site building Modules.

568.

Which design pattern used by Drupal?

Answer»

SINGLETON DESIGN PATTERN

569.

Why we used template.php in Drupal?

Answer»

It ALLOWS you to OVERRIDE a THEME FUNCTION. It is available in the theme directory.

570.

What is taxonomy in Drupal?

Answer»

It is a powerful CORE module, gives our SITES use of the organizational keywords known in another systems as categories or tags, or metadata. Taxonomy allows you to connect, relate and CLASSIFY your website's content. These terms are gathered within "vocabularies". It is the PRACTICE of CLASSIFYING content.

571.

How can we add Regions in Drupal Theme and list some Default Regions?

Answer»

Adding regions to a theme requires two THINGS that's are GIVEN below :-

  • Adding region meta-data to your THEMENAME.info.yml file.
  • Please edit your page.html.twig file then print new regions.

Default Regions

  • page.header
  • page.primary_menu
  • page.secondary_menu
  • page.highlighted
  • page.help (It has DYNAMIC help text for admin pages)
  • page.CONTENT (main content of current page)
  • page.sidebar_first
  • page.sidebar_second
  • page.footer
  • page.breadcrumb
572.

What are the new features of Drupal 8?

Answer»
  • New THEME Engine : It includes a brand new theming engine CALLED Twig. It is PHP-based, flexible, fast, and secure.
  • Drupal 8 is mobile first now
  • It has extensive multilingual features right out of the box.
  • It has configuration management built into it at the file-system level so that carrying over configuration elements in Drupal 8.
  • Easy Authoring : It bring unprecedented power into the hands of the Content Editor, with WYSIWYG editor CKEditor now bundled with the core.
  • Views Now PART of its Core :
  • Better Support for Accessibility
  • Web SERVICES in-Built in Drupal 8
  • In Drupal 8 it has Guided Tour
  • JavaScript Automated Testing in Drupal 8
  • Loading Speed improvement in Drupal 8.
573.

How to create a new theme in Drupal 8?

Answer»

To create a theme in Drupal 8 from scratch, use the following STEPS:

  • Create a theme folder inside Drupal 8 to store your theme in a .info.yml FILE and LIBRARIES file.
  • Create the .info.yml file
  • Create the .libraries.yml file.
  • Start CREATING the stylesheets
  • Now, create designs and then, you have your own theme in Drupal 8.
574.

How do you enable twig to debug in Drupal 8?

Answer»

While there are many methods to enable TWIG Debug, this is one of the easiest and simple way

  • Step 1: Navigate to the \sites\default in the Drupal 8 dashboard.
  • Step 2: Now, start the process by making a copy of the default.services.yml file and renaming it to services.yml (if services.yml does not already exist).
  • Step 3: Next, open the file and search for this phrase 'twig.config'.
  • Step 4: Once you’ve GOT the phrase, set the debug mode to true, auto_reload mode to true and cache to false mode.
  • Step 5: Finally, go to the bottom of the file and copy the following code BLOCK as it is:
Parameters

twig.config:
debug: true

 

575.

How to enable jQuery in Drupal?

Answer»

To install JQuery in Drupal, follow these steps carefully:

  • Start with downloading the jquery_ui Drupal module by using the stable version available (6.x-1.5). Now, move it to your modules folder (e.g. sites/all/modules/jquery_ui)
  • Now, go to the jQuery UI and then download the "Legacy" 1.7.x version. Not the 1.8.x version or any other later branch!
  • After completing the above step, inside a temporary directory, extract the directory "development-bundle" collected from the ARCHIVE and finally rename it to "jquery.ui".
  • After RENAMING, start copying the RENAMED directory, (jquery.ui) into the sites/all/libraries folder (create a separate folder LIKE this if it should look like sites/all/libraries/jquery.ui.)
  • Finally activate the jquery_ui module in Drupal version 8.
576.

What is node in Drupal?

Answer»

It is a piece of individual CONTENT such as a PAGE, POLL and article. Most content on a DRUPAL website is stored/treated as "NODES".

577.

What is DRUSH in Drupal?

Answer»

It is a very useful tool as it helps you perform various admin TASKS using ONE or two commands in the terminal, replacing the need for MANY clicks and page refreshes in the UI. "DRUSH" is an awesome shell INTERFACE for managing Drupal right from our cloud server using command line.

2. How caching works in Drupal 8?

Drupal consists of multiple layers for execution. Hence, caching is a vital aspect of Drupal to measure performance accurately.

Here are the various WAYS of caching in Drupal:
  • DRUPAL INTERNAL CACHING
  • CUSTOM CACHE USING DRUPAL’S CACHE API
  • DRUPAL VIEWS CACHE:
  • MEMCACHE
  • OPCODE CACHE
  • REVERSE PROXY - VARNISH
  • BOOST Caching
  • Using Content Delivery Networks(CDN)
578.

How to display custom field value in page?

Answer»

You can USE get_post_meta(get_the_ID(), 'custom_field_name', TRUE);

// custom_field_name is FIELD NAME.

579.

How to add your custom image size for the featured image in WordPress?

Answer»

The following STEPS need to USE in order to customize image SIZES in the CSM WordPress. Edit your EXISTING theme’s funcation.php file and add the following code add_image_size( 'image_size_name', 1000, 590 );

580.

How can you display a list of child pages in WordPress?

Answer»

We can USE simplay WP_Query() with post_parent and post_type, then we can get all CHILD PAGES of that particular parent page.

Example

$my_query = new WP_Query(ARRAY(
    'order' => 'ASC',
    'orderby' => 'menu_order',
    'post_parent' => 13,
    'post_type' => 'page',
));
if($my_query->have_posts())
{
    while($my_query->have_posts())
       {
          // display your required things
       }
}

 

581.

How to create Shortcode function in WordPress?

Answer»

Users can MAKE shortcodes with the use of WordPress Shortcode API, as it ENABLES users to take benefits of existing theme features from any test-based area on WordPress site.

The shortcode FUNCTIONS can be created in three simpler steps-

1. Create function in function.php and register
function display_related_posts($array = array()) {
   <div class="col-md-12 remove-padding m-t20">Shortcode function defination</div>
}
add_shortcode('display_related_posts', 'display_related_posts');

2. Now you can call anywhere in FILE or editor with this function.
do_shortcode('[display_related_posts]');

582.

How to check a featured image exists or not in WordPress?

Answer»

We can USE has_post_thumbnail() METHOD to CHECK the FEATURED image is exists or not.

Example

if ( has_post_thumbnail() ) {
    the_post_thumbnail();
}

583.

How to display an image URL from thumbnail in WordPress?

Answer»

You we use get_the_post_thumbnail_url(); . You can use this inside LOOP or OUTSIDE loop. If you are USING this outside of loop then you have to PASS post ID otherwise its optional in CASE inside loop.

584.

What is wp_head() in WordPress?

Answer»

It is a type of action hook where the CODE is DYNAMICALLY ADDED to a THEME in between HEAD tag.

Example

<head>  
    <?php wp_head(); ?>
</head>

585.

What is wp_enqueue_script() function in WordPress?

Answer»

In order to include JavaScript file in WordPress, a special FUNCTION can be used NAMELY wp_enqueue_script (). In WordPress, the PRELIMINARY goal of wp_enqueue_script () is to add a JavaScript file which is one of the WordPress action HOOKS. In order to use the wp_enqueue_script (), users should need to add JavaScript to each PAGE on the WordPress site.

586.

What is the difference between wp_reset_query() and wp_reset_postdata() in WordPress?

Answer»
wp_reset_query()wp_reset_postdata()
This ensures that the query has been reset to the originally created main query.This ensures that the GLOBAL $POST has been RESTORED in the current post inside the main query.
Should be used IMMEDIATELY after every loop using query_posts()Should be used after every custom WP_Query()
587.

How to display the current page title in WordPress?

Answer»

You can DISPLAY CURRENT PAGE TITLE by get_the_title()

588.

What are the new features in WordPress 5.3?

Answer»

Here is the list of new features of WORDPRESS 5.3

  • Improved features of current WordPress blocks LIKE BLOCK appender, CHANGES in block
  • Visual differences in the admin panel.
  • Brand new blocks
  • Uploading and AUTOMATIC rotation of high-resolution images
  • A new way of notifications via Snackbar notices.
  • New default theme Twenty Twenty
  • Typewriter experience
  • Auto-save function
589.

What may be the reason that widgets won’t display in the sidebar?

Answer»

Users have to FIRST ensure that whether the themes they are using support the widget they are wishing to add. In some cases, the problem may occur when the function.php or file similar to that is missing. There are chances also this could happen if the USER FORGETS to save the changes MADE in the widget or to refresh the older page DISPLAY.

590.

What are the scenarios when the plugin menu is not displayed?

Answer»

Users won't be ABLE to SEE the PLUGIN menu when their blog is hosted on free wordpress.com as it’s LIMITED with plugin uses. EVEN the users without an account of administrator-level won’t be able to use the plugin menu.

591.

How is it possible to rename the WordPress folder?

Answer»

Yes, we can rename the WordPress folder. If WordPress is already installed in our device, we have to log in to the weblog as the ADMINISTRATOR and the change the required settings mentioned below.

  • WordPress address (URI)
  • BLOG address( URI)

After the changes, we can rename the folder or directory with the use of the WordPress FILE in it.

592.

What are the basic rules to follow while developing WordPress plugin?

Answer»

Here is a LIST of CRUCIAL rules that require to be followed by the developers while developing a WordPress plugin:

  • Unique user name creation
  • Plugin folder creation
  • Creation of sub-folder for PHP files, assets, and translations.
  • Activation and DEACTIVATION function creation
  • The MAIN plugin file creation and fill the header information
  • Script for uninstall creation.
  • readme.txt file creation
  • Use of proper functions and constants to detect paths of the plugin file.
593.

How to check if any plugin is active in WordPress?

Answer»

With the METHOD is_plugin_active() we can check any PARTICULAR plugin is ACTIVE or not.

How to check

include_once( ABSPATH . 'wp-admin/includes/plugin.php' );

if ( is_plugin_active( 'plugin-directory/plugin-file.php' ) ) {
   // ACTIVATED
}

594.

How do I edit the contents of a page in WordPress?

Answer»
  • Login to WORDPRESS ADMIN area
  • If EDITING a Post, Click "Post" and then click "All Posts." Find the Post you want to edit and make changes. Click Publish.
  • If editing a page, Click "Pages" in left column MENU, and click "All Pages." Find the page you want to update and make changes. Click Publish.
595.

Is WordPress dynamic or static?

Answer»

WORDPRESS is DYNAMIC. This is because NEARLY everything in WordPress, including PAGES, is generated dynamically.

596.

How do you create a page in WordPress?

Answer»

For creating a WordPress PAGE, follow these steps:

  • In your WordPress DASHBOARD Navigation menu, click "Pages" and select "Add new."
  • Add page title
  • Add content.
  • "Page Attributes" SECTION can APPLY parent page or specific template to this new page.
  • "Template" section will allow you to apply any template to the new page.
  • "Order BOX" helps you arrange your page numerically.
  • Preview the page. Hit "Publish."
597.

Where do I insert Google Analytics code in WordPress?

Answer»

While there are different ways to add Google Analytics your WordPress site, here are the 3 most COMMON ones:

  • Through MonsterInsights
  • By inserting plugins for Headers and Footers
  • By INSTALLING Google Analytics in the WordPress THEME
48. How do I make a static page in WordPress?

For creating a static page in WordPress, follow these steps:

  • Go to WordPress Admin Panel
  • Create Front Page by selecting "Add New Page."
  • Name it "Home."
  • Add content to the content AREA of the static page.
  • Publish it.
598.

What is widgets in WordPress?

Answer»

In WordPress, WIDGETS are small blocks that perform specific FUNCTIONS. Different TYPES of widgets are available in sidebars. ORIGINALLY, widgets were designed to provide an easy way to design and STRUCTURE the WordPress theme.

599.

Is WordPress website is secure?

Answer»

A WordPress site is like any other website or APPLICATION and has security threats. In order to strengthen your WordPress’s security, you can CONSIDER implementing a Secure Socket LAYER (SSL) CERTIFICATE.

600.

What is taxonomy in WordPress? Explain

Answer»

Taxonomies in WordPress are USED to group POSTS and post types together. Custom taxonomies can help developers create GROUPS and BRING them under one head.

There are 4 in-built taxonomies in WordPress- Category, Tag, Link Category, and Post FORMATS.