Here's one for you

Hiya Glen,  I've been having some fun with your creation; I decided I wanted more categories for the "Links" page, so I made one for people to add their favorite radio stations.  The new MySql table seems to work and the site seems to be reading the new additions, but it's not displaying them.  I've poured through every part of your code and I can't figure it out.  I attached some screenshots in the hopes that  you'll be able to give me an idea of what's going on.

Good to see someone playing
by cglusky / at 10:53 on April 26, 2006

JTB,
The general flow is this:
For logic -links.php creates a new object of class Link.class.inc (found in the includes folder), Links extends the DataObject with it's own set of metadata (see the top of Link.class.inc). Links.php simply returns all links that belong to a certain user id. It then assigns this info to $Page variables that can be output through your Smarty template.

For display - links.php is associated with whatever template file is declared in templates.ini, which is usually just links.tpl.

I am guessing you are forming a one to many relation between your categories and your links so you may need proper query to return the links sorted by category. I could go on at length about this and I would probably get it wrong, or at least not spell out the best way to do it. But I think the problem you are having is that the default links class knows nothing of your new table or it's relation to links. Glen may tell you to work on making it a plug-in. I have "Creating a Plug-In for Siteframe" on my list of things to do but have not gone there yet. It would be most beneficial if we started exploring that avenue as Siteframe becomes more popular (IMHO). I will say that links are a bit different than other objects in Siteframe as they do not fall into the folder>page>file hierarchy that the rest of Sitframe content follows. The way I got around this was to create a links folder and then put links in a regular page so they enjoyed the same support as other content - e.g. tagging, recent, random. I would even go so far as to say that you could remove the links functionality from the core of Siteframe and make it an optional plug-in. My two cents and a very long-winded pseudo-answer.
Coby

yeah
by jthomasbailey / at 14:58 on April 26, 2006

I went through and copied every file that had anything to do with the Links page and replaced any reference to Link or Links with Station or Stations. Then I duplicated the Links table in the database and did the same. It almost worked, I just can't figure out why it's not displaying the user's stations.

Re: yeah
by cglusky / at 18:02 on April 26, 2006

Do you have the list of files you modified/added? And does your db user have correct privs assigned to your new table (shot in the dark)?

Also, are you able to add new stations through the normal edit function and have them show in the db table itself, even though they do not display in the template? You start getting into API keys etc here, which I have not looked at much.

Any error logs?

Re: Re: yeah
by jthomasbailey / at 19:22 on April 26, 2006

Added: Station.class.inc, StationPageRel.class.inc, station.php, stations.php, and stations.tpl. Edited: template.ini, siteframe.inc, en-us.ini, and I think that's it. I just used a text editor and replaced the word Link with the word Station.

Created: SQL tables bpt_stations and bpt_page_station_station, exact duplicates of bpt_links and bpt_pagee_station_station.

The setup.sql file didn't show these tables at first, so I deleted them and added them with the admin page. But now I have setup.sql, which doesn't show them, setup.sql.1 which does, and setup.sql.2 which doesn't again. The actual database works fine, it just doesn't want to display them when I go to the Stations.php page. But when I do a search for a station I added, it shows up (sort of, see attached pic. #1).

Re: Re: Re: yeah
by cglusky / at 09:04 on April 27, 2006

OK. I think it's safe to take page_station_station out of the picture. You would need to be very careful with the find/replace in that area. Should be page_station_link as it would be used to establish a link (relation) between a page and a link (URL). A bit confusing but if you look at page_tag_link it helps. As far as I know page_link_link is not currently in use. Glen could shed further light on that. Anyway, the copies you made should not hurt anything, they just won't be used.

When you edited siteframe.inc I am assuming you added Stations to the $ALL_CLASSES array. Don't want to replace Links in that case or you will loose the Links class.

Based on what you are telling me it sounds like it should work. Hard to tell what's going on without seeing the code. My guess is that you have a syntax error someplace. Station as stations or something similar. And caps count too. I would do another side-by-side compare of your code with the original links code and make sure it's all correct.

I also ran into a problem with Smarty after moving a site. Everything worked fine but Smarty would not loop for some items. I ended up deleting the contents of the cache and compile dirs (found under the files dir). And that fixed my problem.

Keep the faith; we'll get it.
Coby

Debug Mode
by cglusky / at 09:06 on April 27, 2006

Glen,
What's the best way to get debug output for problems like this??? I thought I saw a setting buried someplace.
Thx,
Coby

Re: Debug Mode
by cglusky / at 09:43 on April 27, 2006

Found it for Smarty.

Simply place {debug} in your stations.tpl file. I actually put it in my footer.tpl so it loads for all pages. Be careful though as it exposes a bunch of information. You may want to wrap it in a user.id check or something if you are not on a local test machine. Also, make sure you allow pop-ups as the console is a pop-up by default.

I got it
by jthomasbailey / at 10:11 on April 27, 2006

You were exactly right, I had a "station" which should have been a "stations". Thanks, I owe you.

Re: I got it
by cglusky / at 10:28 on April 27, 2006

No problem. Would be interested to know if making it a plug-in works as well.