Jump to content
TNG Community
Marilyn

Hopelessly Confused Creating Custom Pages

Recommended Posts

Marilyn

I keep thinking I'm getting close to getting my TNG site fully working after 3 weeks of working on it, but then discover yet another problem.

Here's one.  I'm trying desperately to follow the directions for creating custom pages as shown on this page: http://tng.lythgoes.net/wiki/index.php/User_Pages_-_Getting_Started

My custom pages work just fine until you try to follow almost any standard link from that page, and then my custom pages sub-directory is inserted into the URL.

So, for example, a link on the page goes to http://roots.inforapenny.com/tng/newacctform.php from the home page or any non-custom page, but from any custom page, it wants to go down this path: http://roots.inforapenny.com/tng/mypages/newacctform.php

I'm using v11.0.1, template 15, and my site is at http://roots.inforapenny.com/tng/  An example of a custom page is: http://roots.inforapenny.com/tng/mypages/kinshipchart.php

The code at the top of another custom page is shown below (they all have the same basic code at the top and the same problem):

<?php

include( "../tng_begin.php");
if( !$cms['support'] )
	$cms['tngpath'] = "../";

$yourtitle = "Privacy";
 
$yourlink = "/mypages/Privacy.php";

$logstring = "<a href=\"$mypages/Privacy.php\">Privacy</a>";
writelog($logstring);
preparebookmark($logstring);

//STEP 5: Remove the comments (leading slashes) on the next line if you *DON'T* want the TNG menu bar to show on your page.
//$flags['noicons'] = true;

tng_header( $yourtitle, $flags ); 
?>

Perhaps I should mention that I'm also hopelessly confused regarding the cust_text file and customconfig.php file and mods, but I think that's another issue, though it may not be.

I'll also mention that I have a companion site in Wordpress, and I've installed, then deactivated, then reactivated the TNG Wordpress Integration plugin in that site, which I am also confused about, but I mention that here only in case there is some interference from that plugin (WP and TNG are each installed in their own folders at the root of the main directory; it looks like the TNG Wordpress Integration plugin added another instance of Wordpress also in the root of the main directory, though not in a subfolder thereof, as TNG and my initial Wordpress site are).  OK, I hope this makes sense and that somebody can help me.

TIA!

 

Marilyn

Share this post


Link to post
Share on other sites
Marilyn

Ignore the last paragraph above.  I decided to deinstall completely TNG WordPress Integration, which may simplify a problem or two...

Share this post


Link to post
Share on other sites
Ken Roy

Marilyn,

Most of the links on your custom page appear to be OK.  The Register link at the bottom is not, so it may depend on how that is coded in your Template Settings I think.  Since you site is locked down (requires a login) I cannot tell if it works OK within TNG when the file is in a subfolder. 

Share this post


Link to post
Share on other sites
jayat1familytree

Hopefully this wont add to your confusion....

Here is the 'old' way

(the new way is the "tng_begin" replaces several steps from here)

This example is for a file that resides in the same folder as your main tng installation.

Just insert your own content between the start and end content

The cust_text file is where you need to place any $text['privacy']  definitions , so in the case here of your privacy file you want to make sure that you have added

$text['privacy'] = "Privacy" 

into the cust_text file, otherwise the name Privacy will not appear.

 

The custom config file holds your settings for the entire site

Hope that this helps

 

Jay

---------------------------------------------------------------------------------------------------------

<?php
include( "begin.php");
include($cms[tngpath] ."genlib.php");
include($cms[tngpath] ."getlang.php");
include($cms[tngpath] ."$mylanguage/text.php");
tng_db_connect($database_host,$database_name,$database_username,$database_password) or exit;
include($cms[tngpath] . "log.php" );
$logstring = "<a href=\"privacy.php" . "tree=$tree\">{$text['privacy']}$treestr</a>";
writelog($logstring);
preparebookmark($logstring);
tng_header( $text['privacy'], $flags );
?>
<!-- Column 1 Start-->
<h1 class="header"><img src="<?php echo $cms['tngpath']; ?>img/privacy.png" height="32" alt="" class="headericon"/>&nbsp;<?php echo $text['privacy']; ?></h1><br clear="left" />
<?php

echo tng_coreicons();

echo treeDropdown(array('startform' => true, 'endform' => true, 'action' => 'surnames', 'method' => 'get', 'name' => 'form1', 'id' => 'form1'));

?>
<!--Start content-->
 

<!--end content-->

<?php
tng_footer( "" );
?>

 

Share this post


Link to post
Share on other sites
Marilyn

Thanks, everyone, for your comments and helpful advice.  I think my biggest problem at the moment is that I don't understand how the customconfig and cust-text files are supposed to work.  I only discovered them recently and haven't found the Wiki or whatever that may explain them conceptually.  I'm using a mod called Custom Hook Menu Mod, and this is where I first started running into these problems (or noticing them).

So, today, I'm planning to do my best to figure them out.  If anyone knows a specific page that explains how they work in general and specifically, please send me the link!

Also, I've set up a guest user account, in case anyone wants to check things out further...(and much thanks if you do!): 

un: guest

pw: *guest-user1

I am also checking out/testing the suggestions that everyone sent...

BTW, the links that break from any page in my "mypages" subfolder are: 

  • search (in the little green menu bar)
  • register here (in the footer)
  • contact us (in the footer)

Only the 2 in the footer return a 404.

It seems to be working better than a couple days ago, so maybe I did something right after all!

Share this post


Link to post
Share on other sites
Ken Roy

Take a look at the TNG WIki article on How TNG Builds a Page and other articles in the How TNG Works category

The cust_text.php file in each language folder is used to provide overrides to the TNG $text or $admtext variables and to define your own $text variables if you run a multi-language site.  See also Making Changes to TNG and associated articles.

Share this post


Link to post
Share on other sites
Marilyn

Thanks, Roy!  Will check those out.  Teach a girl to fish and all that...

Share this post


Link to post
Share on other sites
Marilyn

Just thought I ought to follow up on my initial post.  Hopefully, someone will still see this.

I have managed to solve all the link problems on my custom pages, save for one.  The "Search" link in the secondary menu-bar still does not work on any custom page.  Instead, the page returns to whatever page you started from, i.e., if on the "Privacy" page, when you click on "Search," it brings you back to the "Privacy" page.

search-link.jpg

I believe I have read and tried everything I know how to do, and many things I didn't know how to do.  At this point, I'm ready to throw in the towel, unless anyone has any ideas about what could be causing this and how to fix it.  While I would prefer that the search link would work before I invite my relatives to start using the site, I've been at this so long, it's time to move on.  Uncle!

For the most part, the code is still the same as in my initial post up top, except I changed the folder name where all these help files live from "mypages" to "help", oddly enough. ;)

Which didn't "help," but it didn't hurt, either.  Anyway, the whole path to any of the custom pages in question is now http://roots.inforapenny.com/tng/help/kinshipchart.php (etc.).

 

Cheers!

Marilyn

Share this post


Link to post
Share on other sites
theKiwi

The problem is that the page isn't loading the items from the "js" folder that it expects/needs to be able to open the overlay that clicking Search normally opens. If you look at the page with the browser's developer console open you'll see errors about this.

Also your pages are showing different code than my pages built from the historytemplate.php file. Take a look at this page

http://lisaandroger.com/tng/histories/historytemplate.php

for example. If you click "Genealogy Search" you'll see what is supposed to happen. The underlying code on my site is 

<a href="searchform.php" onclick="return openSearch();" title="Genealogy Search" class="tngsmallicon" id="search-smicon">Genealogy Search</a>

On your site the underlying code is

<a href="" onclick="return findItem('G','','','');" title="Search" class="tngsmallicon" id="search-smicon">Search</a>

so I'm not sure what is causing your site to have this different behaviour though :( 

Roger

Share this post


Link to post
Share on other sites
Marilyn

Kiwi, wow!  You found the problem.  Looking back now, it seems a bit obvious, but...famous last words.  I had installed the Similarity Search mod, and when I uninstall it, everything works.  Sigh.  It's such a cool search tool, I hate to lose it.  

In fact, that mod also has a link in the Find menu (Word Search) which works from all pages except my custom pages, again.  So, is the problem something missing from my custom pages, or something misconfigured by this mod?  I wonder if the mod developers have run into this before.  You think they could help, or is it something wrong with my custom pages?

 

Cheers,

Marilyn

Share this post


Link to post
Share on other sites
jayat1familytree

Marilyn,

 

No, the Genealogy search only searches the names or places in the tng genealogy database.

It does not search the site content for any keyword content.

THats why your custom pages wont be found.

BUT it you want to add the menu bar item into your custom pages, look at the code example in the page roger links to (which is the historytemplate.php)

Share this post


Link to post
Share on other sites
Marilyn

Ah, thanks, Jay.  Actually, the problem isn't trying to FIND my custom pages; it's that the Search link in the menu bar doesn't do anything at all when you click on it FROM a custom page, but I did discover this is only true when I'm using the Search Similarity search mod.  I can imagine this would frustrate some of my users who expect the Search link to work from whatever page they're on.

But you bring up an interesting point: the search link (using the S.S.mod) does not work on the history pages either, which I hadn't thought to check before now.  The normal Search link (that comes standard with TNG) does work from the custom pages.  I'm going to do some testing to see where the Search Similarity mod works and where it doesn't.  I hate to lose it; it's very useful for finding foreign alphabet names.

Thanks for sending me in a better direction.  At least I know now the problem is probably NOT how I coded my custom pages. :)  So that's a piece of good news.

Share this post


Link to post
Share on other sites
Marilyn

P.S. To be more precise, it works on history pages accessed from the History menu item under "Media," but not on the history pages I ftp'd up to the site separately.

Share this post


Link to post
Share on other sites
theKiwi
54 minutes ago, Marilyn said:

P.S. To be more precise, it works on history pages accessed from the History menu item under "Media," but not on the history pages I ftp'd up to the site separately.

That's to be expected, since it's searching the database for matches, not any/all of an unknown number of separate pages you may have created and uploaded to any number of directories on your site.

Roger

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×