Drupal 7 header - drupal-7

This may sound like a very obvious question for drupalistas, but for the life of me, I can't figure out where the header element is so I can rearrange it to put the search above the main menu. I am using a subtheme off of a very stark theme called framework.
I see this line:
I want to know where the code resides so I can set the blocks to print the search block first and the main menu second.

You can move your blocks around in the page.tpl.php template file.
If you've not done so already copy modules/system/page.tpl.php to YOUR_THEME/templates/page.tpl.php and clear your cache out.
Open the page.tpl.php file and you'll see where your blocks are printed out.
e.g. <?php print render($page['header']); ?>
Will print your header block out.
From there you can put blocks in any order you want.
To reorder in a block, go to admin -> blocks and use the arrows on the left of each block to drag them into the order you want them to be rendered. Remember to save your order and you should be set.

Related

Adding Footnotes (or margin notes etc.) to The Quilljs Editor

I'm looking for a way to add footnote / endnote functionality to the QuillJS.com editor. My requirements are that the note 'text' itself can still be edited as if it were document text -- hiding it away in an attribute is probably not going to work very well.
I wonder if this can be achieved?
To take a trivial example of a document:
Here is a document text as usual1
1This is the footnote text
My guess is that the best way to achieve this would be to:
Hold the actual note text as a series of blocks (note-text blocks) at the end of the document. Each block would need a unique name.
Insert the anchors (the numbers in the main text) as either some kind of embedded object or an inline blot of some kind.
When a new note is added, add the anchor inline, and add a new "note-text" block for that anchor at the end of the document, and move the cursor there.
Have some kind of mechanism to keep the order of the notes at the end of the document in sync with the order of the note-anchors in the main text.
Make sure that the block for the note text could only be deleted if its anchor was deleted. Conversely, if an anchor is deleted, remove the note-text block.
Clicking on the note-anchor would take the cursor to the note-text block, and clicking on the number at the start of the note-block (as rendered) would take the cursor back to the anchor.
Numbering would be determined by the order of the anchors in the document.
My question (for people who have experience of extending QuillJS) is: is such a system even possible? The only module that seems to come close to this level of functionality is the better-tables module.
I would really appreciate any insights about whether such a system could be achieved or some hints about how to do it.

How to render content outside of drupal instance

i created one website using drupal. In Drupal i crated content pages in that instance using wisywig editor. now my intention is using this content block outside of drupal. can you anyone please help me how to use this content block outside of drupal (with code or something else).
i mean how to render content outside of drupal instance
Rendering blocks and nodes is straight-forward.
Before you can do either you must initiate the drupal core:
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
Using getcwd() assumes you are placing the script in drupal's root.
To display blocks, use block_load():
$blocks[] = block_load('block',$delta); //first block to display
$blocks[] = block_load('block',$delta2); //second block to display
print drupal_render(_block_get_renderable_array(_block_render_blocks($blocks)));
For nodes, there are several approaches. node_view(node_load()) seems to be the cleanest:
print drupal_render(node_view(node_load($nodeId)));

Drupal 7 Template Suggestions not working

If I create a region in the info file like:
regions[footer_panel] = Footer panel
then render this in the page template (page.tpl.php):
print render($page['footer_panel']);
then try and create an overide template to work with (as described in documentation):
block--footer_panel.tpl.php
finally print some static text in that file, Im not getting any results. Please could someone advise?
Caches have been flushed and block.tpl is in the templates folder.
Try adding the generic block.tpl.php to the theme as well. Sometimes it won't pick up the block template suggestions if that file isn't present first. Be sure to clear the cache again.
I'm also assuming that you have a block inserted into that region. If you do not have a block designated to show in that region creating a template file will do nothing. You need to create a block and then create the template file based on that blocks name/ID not the region name.

module block view only prints if it is on a certain page

In Drupal 7 Is there a way for me to insert my block into a region only on certain pages inside of a module code? Or do I have to do that in the gui block list?
I've created a banner module, but want to be able to give the ability to choose the pages it appears on. For starts, it could appear only on the front page. I tried a $is_front check, but I am getting an error that $is_front or $variables are undefined.
This doens't work inside of my block_view() function in my module.
if ($is_front){
$block['content'] = theme('mydata', $banner_node_list);
}
I think your best bet is to use the block GUI to select where it appears. I can't see any benefits to doing it in the code when it's already built in to be honest.

CakePHP, layout with common header and footer

I have a fresh CakePHP 1.3 install and it currently has one layout. I am about to add a few more but I don't want to have to keep coping and pasting the Header and footer in to each layout.
At first I thought that I could do this with an Elements, but it does not seem to render the Configure::read('var_name'); chunks while in an element.
My other thought was to create a common layout and use lots of variables to add and remove sections from the screen depending on what type of user they are... but this would be troublesome to say the lest.
My question is:
Is a way to include a header/footer section in to a layout while getting the Configure::read() function to output text?
I still think that elements are the right way to go for this (shared view snippets, FTW). I have to admit that I'm a little surprised that elements can't read from the Configure class, but I'll concede that I haven't tried it. If that really won't work, then try passing the values directly to the element:
<?php echo $this->element( 'partial_name', array( 'var_name', Configure::read( 'var_name' ); ?>
In the element, you should then be able to access the variable simply as $var_name. For more on passing variables to elements, take a look at the [Passing Variables into an Element](Passing Variables into an Element) section of the element documentation.
Hope that helps.
Create element with new header suppose new_header.ctp. Then put element('new_header')?> in your preferred position layout

Resources