https://www.icyphoenix.com/viewtopic.php?f=4&t=6372
-----------------------------------
DWho
Thu 27 Aug, 2009 13:23

CMS - Standard Pages In CMS
-----------------------------------
Standard pages in icy 1.3 works differently than before in icy1.2.. you no longer add new pages this way but instead use the cms pages option in your cms pages...

Standard pages works by allowing you to add blocks to new pages you create or mods you have added...

for example I have installed a mod to my site  called test mod... in that mod there is a page called test.php.. when i open that page in my site I see a normal page with no blocks...

I have global blocks activated on all my site pages and I want to add global blocks to this page...

Go to ACP and click on the cms link in the top right hand corner. [img]http://www.icyphoenix.com/files/images/166/cms_link.png[/img]




after clicking here you will see the main cms page it look like the example below.

 [img]http://www.icyphoenix.com/files/images/166/standard_pages_link.png[/img] 




click on the standard Pages link and it will take you to the main stand links page as the example shows...

 [img]http://www.icyphoenix.com/files/images/166/standard_pages.png[/img]



here you can save changes quickly by ticking the boxes for global blocks or breadcrumbs the just click on the [b]save changes[/b] button at the bottom of the page..


to add blocks to new pages click on the add Site Page box at the bottom of the page this takes you too a new page as shown below...

 [img]http://www.icyphoenix.com/files/images/166/new_page_1251370952_767000.png[/img]  

here you add the details of the page you wish to have blocks or breadcrumbs showing...

for example:

[b]Name:[/b]  here write the name of the page so you remember it later... i will call mine [b]Test Page[/b]

[b]Page ID
This is the Page ID used by the auth system. Chars allowed: lower-case alpha, numbers, underscore, no spaces.[/b]

this does not have to be complicated but you need to remember it for later use... i am going to call it test_mod remember the underscore when there is a space between words... 

[b]Filename[/b] this is the name of the php file so our example here is [b]test.php[/b]

[b]show global blocks[/b]  click  on the radio button to add global blocks to this page so hit [b]yes[/b]

[b]Page Navigation Block (Breadcrumbs)[/b] if you wish to show standard icy breadcrumbs to you page then click on yes.. i do not for my example so i am leaving it as no..

[b]View permissions[/b] this basically allows you set the page to who you wish to see it so for now I have left it to all meaning everyone..

Here is the finished result in the image below.

 [img]http://www.icyphoenix.com/files/images/166/saved_new_page.png[/img]

now click on the submit button at the bottom of the page to store the data in your database...

you will see the new page added as the example below.

 [img]http://www.icyphoenix.com/files/images/166/new_page_added.png[/img] 

one thing left to do before adding blocks to this page and for it to work...

you need to open the php file you used in setting up the standard page  mine is [b]test.php[/b]

[b][color=darkred][size=14]please remember to back up this page first in case there is any mistakes...[/size][/color][/b]

look for this in that page

[code linenumbers=false]define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
include_once(IP_ROOT_PATH . 'includes/functions_groups.' . PHP_EXT);[/code]

and directly afterwards add

[code linenumbers=false]$cms_page_id = 'test_mod';
$cms_page_nav = (!empty($cms_config_layouts[$cms_page_id]['page_nav']) ? true : false);
$cms_global_blocks = (!empty($cms_config_layouts[$cms_page_id]['global_blocks']) ? true : false);
$cms_auth_level = (isset($cms_config_layouts[$cms_page_id]['view']) ? $cms_config_layouts[$cms_page_id]['view'] : AUTH_ALL);
check_page_auth($cms_page_id, $cms_auth_level);[/code]

now in that code you need to find... 

[code linenumbers=false]test_mod[/code]

and change it to the page id that you picked when you set up the new standard page...

save the file and upload it to your site...

now you can add blocks wherever you like on this page just as you would on a normal cms page.

 I hope this helps

 :mrgreen:  :mrgreen:


-----------------------------------
Mighty Gorgon
Thu 27 Aug, 2009 20:35

Re: [DOC] Standard Pages In Icy 1.3
-----------------------------------
Great doc DWho.

Thanks for sharing it.


-----------------------------------
DWho
Thu 27 Aug, 2009 20:51

Re: [DOC] Standard Pages In Icy 1.3
-----------------------------------
thank you

 :mrgreen:  :mrgreen:


-----------------------------------
sealys
Tue 24 Nov, 2009 12:59

Re: CMS - Standard Pages In CMS
-----------------------------------
hello, 
i try to find a way to include a unique product in category menu. To do that i need a code for calling the product id in cms bloc. any idea ?

thanks for your help


-----------------------------------
Mighty Gorgon
Wed 25 Nov, 2009 13:42

Re: CMS - Standard Pages In CMS
-----------------------------------
[quote user="sealys" post="46153"]hello, 
i try to find a way to include a unique product in category menu. To do that i need a code for calling the product id in cms bloc. any idea ?

thanks for your help[/quote]
You are providing very poor informations about what you need, and this forum is not the right place for such kind of requests.

Please use the General Support section by providing as many informations you can.


-----------------------------------
AndyGpy
Sat 30 Oct, 2010 22:09

Re: CMS - Standard Pages In CMS
-----------------------------------
Right Guys,

excuse the NOOOB !!

Right i have a webpage called alertz2.php

[code linenumbers=false]if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
include_once(IP_ROOT_PATH . 'includes/functions_groups.' . PHP_EXT);
include(IP_ROOT_PATH . '/alerts/alertsconfig.'.PHP_EXT);
$cms_page_id = 'scotalertz';
$cms_page_nav = (!empty($cms_config_layouts[$cms_page_id]['page_nav']) ? true : false);
$cms_global_blocks = (!empty($cms_config_layouts[$cms_page_id]['global_blocks']) ? true : false);
$cms_auth_level = (isset($cms_config_layouts[$cms_page_id]['view']) ? $cms_config_layouts[$cms_page_id]['view'] : AUTH_ALL);
check_page_auth($cms_page_id, $cms_auth_level);

// standard session management
$userdata = session_pagestart($user_ip);

if ((!$userdata['session_logged_in']) ) 

   {
        redirect(append_sid(LOGIN_MG . '?redirect=alerts.' . PHP_EXT));
	
   }

else

   {
		init_userprefs($userdata);
		// set page title
		$page_title = "Scotbird alerts - Members only area !! ";

		// standard page header
		include(IP_ROOT_PATH . 'includes/page_header.'.PHP_EXT);
		
		// Connect to the database 
		
		$start = ( isset($_GET['start']) ) ? intval($_GET['start']) : 0;
		$start = ($start < 0) ? 0 : $start;
		


		$db = new sql_db($alerts_mysql_host,$alerts_mysql_username,$alerts_mysql_password,$alerts_mysql_db,false);

    	if(!$db) 
		{
        		die("Database Connection Failed:- Please Contact Site Admin" . mysql_error());
    	}

		// assign template
		$template->set_filenames(array('body' => 'alertz.tpl'));	
		
			$tbl = $userdata[username];
			$sql = "SELECT COUNT(*) AS num FROM alerts";
			$result = $db->sql_query($sql);
			$row = $db->sql_fetchrow($result);
			$number = $row['num'];
	
			$lt = strlen(date("d"));	
			if ($lt != 2)
			{	
				if (date("d") == "1")
				{ 
					$datestr1 = '0' .((date("d")+'30').'/'.date("m")-'1');
					$datestr2 = date("d/m");
				}
				else
				{
					$datestr1 = '0' .((date("d")- 1).'/'.(string)date("m"));
					$datestr2 = (date("d/m"));
	
				}
			}
			else
			{
				$datestr1 =  ((date("d")- 1 ).'/'.(string)date("m"));
				$datestr2 = (date("d/m"));
			}
	 
			$sql = "SELECT DISTINCT region FROM alerts ";
			$result = $db->sql_query($sql);
	  
			if (!($result = $db->sql_query($sql)))
			{
  			 
				die("Database Query Failed" . mysql_error());
			} 

		// This is where you would add a new VARS Array if you intend to use your own custom VARS.
		
		
		while ($row = $db->sql_fetchrow($result))
			{
   				$region_filter_options .= '<option value="' . $row['region'] . '">' . $row['region'] . '</option>';
			}
			
		$sql = "SELECT DISTINCT species FROM alerts ";
	
	   	$result = $db->sql_query($sql);
	  
		if (!($result = $db->sql_query($sql)))
		{
			die("Database Query Failed" . mysql_error());
		} 

		// This is where you would add a new VARS Array if you intend to use your own custom VARS.
		
		
		while ($row = $db->sql_fetchrow($result))
		{
				$species_filter_options .= '<option value="' . $row['species'] . '">' . $row['species'] . '</option>';
		}

		$sql2 = "SELECT * FROM alerts WHERE region = '".$MyFormListVariable."'" ;
	
	   	$result2 = $db->sql_query($sql2);
	  
		if (!($result2 = $db->sql_query($sql2)))
		{
			die("Database Query Failed" . mysql_error());
		} 

$i   = 1;

		while ( $row2 = $db->sql_fetchrow($result2) )
		
		{
			$template->assign_block_vars('alerts', array( 'POS' => $i ,
			   		'REGION' => $row2['region'],
					'SPECIES' => str_replace("%", "'",$row2['species']),
					'DATE' => $row2['Date'],
					'TIME' =>  $row2['time'],
					'COMMENTS' => str_replace("'", "%",$row2['comments']),
					)
				);
			$i++;
		}
		
		
		$template->assign_vars(array(
		'USERNAME' => htmlspecialchars($userdata[username]),
		'REGION_FILTER' => $region_filter_options,
		'SPECIES_FILTER' => $species_filter_options,
				)
			);


		// An attempt at pagenating the results	
		$sql = "SELECT count(*) AS total FROM alerts";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Error geeting total list', '', __LINE__, __FILE__, $sql);
		}
		if ( $total = $db->sql_fetchrow($result) )
		{
			$total_species = $total['total'];
			$pagination = generate_pagination('alerts.' . PHP_EXT . '?mode=' . $mode . '&order=' . $sort_order, $total_species , 50, $start) . ' ';
		}
		$db->sql_freeresult($result);

		$template->assign_vars(array(
			'PAGINATION' => $pagination,
			'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / 50 ) + 1 ), ceil( $total_species  / 50 )),
			'L_GOTO_PAGE' => $lang['Goto_page']
				)
			);

			
		// Build the page
		$template->pparse('body');

		// standard page footer
		include(IP_ROOT_PATH . 'includes/page_tail.'.PHP_EXT);

   }
?>

[/code]


I have done the standard page Link

 [img]http://www.icyphoenix.com/files/images/5799/scotalertz1.jpg[/img] 

I have set it as shown in picture below

 [img]http://www.icyphoenix.com/files/images/5799/scotalertz2.jpg[/img] 

When i click on the Preview in the standard page view i get

"Hacking Attempt" warning and nothing else,

Can someone assist me please.

Regards


-----------------------------------
spydie
Sat 30 Oct, 2010 22:58

Re: CMS - Standard Pages In CMS
-----------------------------------
you forgot the 

[code]define('IN_ICYPHOENIX', true);[/code]

right on top of all


and maybe kill the crtracker if you keep getting the message


-----------------------------------
AndyGpy
Sat 30 Oct, 2010 23:23

Re: CMS - Standard Pages In CMS
-----------------------------------
Ok now i got that bit working, how do i get the menu bar at the side as it does not show


-----------------------------------
spydie
Sun 31 Oct, 2010 01:07

Re: CMS - Standard Pages In CMS
-----------------------------------
go to your cms standart pages and click on alertz. you should get the possibility to asign blocks to the page


