i have set up a page where the user can add new links to external site!
once the user has added a new link it goes into the db and populates the links section on the site!
my php code works outside the cms on the site but not withing cms pages?
php:-
".$newLinkTitle."";
}
}
?>
and in my html:-
Products
Is it because there is already a stream open to the db?
The exact same code is working on this page: http://www.dat1.co.uk/contact.php
many thanks in advance
Andrew
Get links from db and write to website??
Get links from db and write to website??
Last edited by thintech on Sun Mar 29, 2009 4:34 pm, edited 1 time in total.
Re: Get links from db and write to website??
any one have any suggestions?
how do i pull info from the tables in the database to populate the menu?
just to clarify......
i have a page on the site where the user can easily add new links to external sites...
http://www.dat1.co.uk/link/
username and password protected.....but when logged in there are 2 simple fields for user to enter which are the Link Name to be displayed and the url to go to.
The reason done like this is the user has no scripting knowledge, so i built the link creator php to auto add target and class options into the tag.
The database now has all his links in and populates the menu on pages outside of cms.
so my question is...
how do i get pages within the cms to also pull the data from the table on the database and display it in the menu?
how do i pull info from the tables in the database to populate the menu?
just to clarify......
i have a page on the site where the user can easily add new links to external sites...
http://www.dat1.co.uk/link/
username and password protected.....but when logged in there are 2 simple fields for user to enter which are the Link Name to be displayed and the url to go to.
The reason done like this is the user has no scripting knowledge, so i built the link creator php to auto add target and class options into the tag.
The database now has all his links in and populates the menu on pages outside of cms.
so my question is...
how do i get pages within the cms to also pull the data from the table on the database and display it in the menu?
Last edited by thintech on Mon Mar 30, 2009 11:51 am, edited 1 time in total.
Re: Get links from db and write to website??
many thanks for trying to help but im getting the same smarty errors when using the code you mentioned above as what i do with my own code...
im testing it by entering inside my content tags just to see the output....
Most Recently Updated';
$output .= '';
global $gCms;
$hm =& $gCms->GetHierarchyManager();
$db = &$gCms->db;
// Get list of 10 most recently updated pages excluding the home page
$q = "SELECT * FROM ".cms_db_prefix()."content WHERE (type='content' OR type='link')
AND default_content != 1 AND active = 1 AND show_in_menu = 1
ORDER BY modified_date DESC LIMIT 10";
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
while ($dbresult && $updated_page = $dbresult->FetchRow())
{
$curnode =& $hm->getNodeById($updated_page['content_id']);
$curcontent =& $curnode->GetContent();
$output .= '';
$output .= 'GetURL().'">'.$updated_page['content_name'].'';
$output .= '
';
$output .= $updated_page['titleattribute'];
$output .= '
';
$output .= 'Modified: ' .$updated_page['modified_date'];
$output .= '';
}
$output .= '';
echo $output;
?>
im testing it by entering inside my content tags just to see the output....
Most Recently Updated';
$output .= '';
global $gCms;
$hm =& $gCms->GetHierarchyManager();
$db = &$gCms->db;
// Get list of 10 most recently updated pages excluding the home page
$q = "SELECT * FROM ".cms_db_prefix()."content WHERE (type='content' OR type='link')
AND default_content != 1 AND active = 1 AND show_in_menu = 1
ORDER BY modified_date DESC LIMIT 10";
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
while ($dbresult && $updated_page = $dbresult->FetchRow())
{
$curnode =& $hm->getNodeById($updated_page['content_id']);
$curcontent =& $curnode->GetContent();
$output .= '';
$output .= 'GetURL().'">'.$updated_page['content_name'].'';
$output .= '
';
$output .= $updated_page['titleattribute'];
$output .= '
';
$output .= 'Modified: ' .$updated_page['modified_date'];
$output .= '';
}
$output .= '';
echo $output;
?>
Re: Get links from db and write to website??
is this code supposed to go on the pages, or in a server side php file?alby wrote:Build un UDT.thintech wrote: any one have any suggestions?
Look here for an example
Alby
i see the other areas in the pages call from db by using curly braces such as {sitename} e.g.
will i need to construct something ina server side php file as opposed to the actual page and give it a name like {links} or something??
if so how is this done?
is there a walk through on cms site? i cant seem to find one??
is that what a UDT is?? - functions that call info using braces {}??
Last edited by thintech on Mon Mar 30, 2009 3:16 pm, edited 1 time in total.
Re: Get links from db and write to website??
ok, in case it's not clear on what i want here is the complete code from the page that works. (outside cms)!
(when i use this on a template inside cms i get smarty errors??)
".$newLinkTitle."";
}
}
?>
DAT 1 - Promotional Clothing
Promotional Items, Clothing, Gifts, Merchandise, Stationary and much more
Site Navigation
Home Page
About Us
Contact Us
Latest News
Products // !!!!!!!!!! LINKS POPULATED HERE!!!!!!!!!!
Contact Us
Address:
DAT1 Limited
Building 8 Audley Avenue
Westbrook, Kent
CT9 5HJ
Tel:
+44 (0) 1843 835 213
E-Mail:
sales@dat1.co.uk
(when i use this on a template inside cms i get smarty errors??)
".$newLinkTitle."";
}
}
?>
DAT 1 - Promotional Clothing
Promotional Items, Clothing, Gifts, Merchandise, Stationary and much more
Site Navigation
Home Page
About Us
Contact Us
Latest News
Products // !!!!!!!!!! LINKS POPULATED HERE!!!!!!!!!!
Contact Us
Address:
DAT1 Limited
Building 8 Audley Avenue
Westbrook, Kent
CT9 5HJ
Tel:
+44 (0) 1843 835 213
E-Mail:
sales@dat1.co.uk
Re: Get links from db and write to website??
Maybe is better that you read first what is UDT and How to Make a User Defined Tagthintech wrote: is that what a UDT is?? - functions that call info using braces {}??
Alby
Re: Get links from db and write to website??
alby wrote:Maybe is better that you read first what is UDT and How to Make a User Defined Tagthintech wrote: is that what a UDT is?? - functions that call info using braces {}??
Alby
You're a star!!
took me 2 mintes....works perfectly....thank you thank you thank you thank you
i have been tearing my hair out lol