Simple method to add search block in concrete5

Use this form in header page(usually search is placed in header)

 <form action="<?php echo $this->url( $resultTargetURL )?>index.php/search/" method="get">
<?php echo $this->url( $resultTargetURL )?>
    <?php  if( strlen($title)>0){ ?><h3><?php //echo $title?></h3><?php  } ?>
    
    <?php  if(strlen($query)==0){ ?>
    <input name="search_paths[]" type="hidden" value="<?php echo htmlentities($baseSearchPath, ENT_COMPAT, APP_CHARSET) ?>" />
    <?php  } else if (is_array($_REQUEST['search_paths'])) { 
        foreach($_REQUEST['search_paths'] as $search_path){ ?>
            <input name="search_paths[]" type="hidden" value="<?php echo htmlentities($search_path, ENT_COMPAT, APP_CHARSET) ?>" />
    <?php   }
    } ?>
    <div><input name="query" type="text" value="<?php echo htmlentities($query, ENT_COMPAT, APP_CHARSET)?>" /></div>
<!--    <input name="query" type="text" value="<?php // echo htmlentities($query, ENT_COMPAT, APP_CHARSET)?>" />-->
    
   <!-- <input name="submit" type="imgage" value="<?php //echo $buttonText?>" />
 
-->
<!--<INPUT TYPE="image" SRC="/~platinum/themes/platinum/images/btn_search.jpg" 
               WIDTH="30"  HEIGHT="30" 
              BORDER="0" ALT="SUBMIT!"> -->

  <div><INPUT TYPE="image" SRC="/~platinum/themes/platinum/images/btn_search.jpg" 
               WIDTH="30"  HEIGHT="25" 
              BORDER="0" ALT="SUBMIT!" ></div>
              
              </form>



Note : change the divs according to your template

FAQ 1: What it does exactly

A : simply its routs to the "index.php/search/?search_paths[]=&query=test&x=16&y=17" 
with some parameters and will shows the results ...

FAQ 2 : if i want to change the css for search results ....?

A : just make modifications in the /public_html/concrete/blocks/search/view.php





Categories: CMS-, concrete5

Creating new editable block area in concrete5

 

<?php
 $a = new Area(‘myarea’);  //creates a new area block with the name myarea
 $a->display($c);
?>

Categories: CMS-, concrete5

footer menu creation in concrete5

Footer Menus

07-25-2010

With a simple modification to an AutoNav template and a Checkbox Page Attribute, you can have a customizable Footer Menu.

Often a client wants a Footer Menu that has some pages from their Main Menu (in the header) and other pages that are excluded from the Main Menu.

Concrete5′s AutoNav block comes with a template file called header_menu.php, it’s located in concrete/blocks/autonav/templates.

Copy that file and rename in footer_menu.php and save it in blocks/autonav/templates.

Open it with your favorite editor and find this block of code:

$isFirst = true;
  foreach($aBlocks as $ni) {
    $_c = $ni->getCollectionObject();
    if (!$_c->getCollectionAttributeValue('exclude_nav')) {

Change the last line to this:

    if ($_c->getCollectionAttributeValue('include_footer')) {

Save that file and go into Dashboard – Pages and Themes – Attributes and add a new Check Box Attribute called “Include in Footer Menu”

 

footer_attribute.png

 

Go to Dashboard – Sitemap and in the property settings for any page that you want to appear in the Footer Menu add the attribute “Include in Footer Menu”.

 

footer_insert_attribute.png

 

Now add an AutoNav block in your footer (or wherever you want the second menu), accept the default settings and click on Add

 

footer_autonav.png

 

We normally add this to a Scrapbook as a block called Footer Menu then insert this code where we want it in our page:

<div id"footerNav">
  <?php
    $block = Block::getByName('Footer Menu');  
    if( is_object($block) ) $block->display();  
  ?>
</div>

Select the Custom Template “Footer Menu” for your AutoNav block.

 

footer_template.png

Now your Footer Menu will display only the pages that have the ‘Include in Footer’ attribute selected.

Most likely the menu will be displayed as a vertical list with bullets. You can style it for a horizontal list or how ever you need it for your site.  A very simple style for a horizontal menu could start out like this:

#footerNav ul {
  list-style: none;
}

#footerNav li {
  float: left;
  padding: 0 5px;
}

Download footer_menu.php

Categories: CMS-, concrete5

Confirm Password Change dialog??? in firforx

October 20, 2011 Leave a comment

 

just removed all the other usernames from firefox’s saved usernames list for my site, and that gets rid of the problem.

Anyway, that’s why you get that prompt in firefox.

 

 

Categories: javascript

Best way to use PHP to encrypt and decrypt?

October 19, 2011 Leave a comment
$key = 'password to (en/de)crypt'; $string = ' string to be encrypted '; // note the spaces 
$encrypted = base64_encode(mcrypt_encrypt
(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); 
$decrypted = rtrim(mcrypt_decrypt
(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), ""); 
 
echo 'Encrypted:' . "\n";
 var_dump($encrypted); // "ey7zu5zBqJB0rGtIn5UB1xG03efyCp+KSNR4/GAv14w=" echo "\n"; 
echo 'Decrypted:' . "\n"; var_dump($decrypted); // " string to be encrypted " 
 
Categories: PHP

php 5.3 : Testing error_reporting to ensure E_DEPRECATED is disabled E_DEPRECATED is enabled

October 5, 2011 Leave a comment

Copy this content and paste in index.php

if (phpversion() >= ’5.3′){
error_reporting(E_ALL ^ E_DEPRECATED);
} else {
error_reporting(E_ALL);
}

Categories: CMS-MADE-SIMPLE
Follow

Get every new post delivered to your Inbox.