MX CSS Menus Forum :: Dynamic Menus with MX Includes
This thread was displayed: 250 times
Starting with 17th May 2007, Adobe Systems will stop offering support for any version of the discontinued InterAKT products. As a result, we will not answer to new support incidents starting with May 17th, 2007. Pending support incidents will still be followed in order to be closed. The product forums will remain open and be transformed in user-to-user forums. The general forums will be made read-only and not allow new posts or comments.
For more information about the affected products visit: www.interaktonline.com/Support/
purple edge
04-29-2006 12:12:44 GMT +2
|
Using CSS Dynamic Menus combined with MXIncludes, I find the code needs to be hacked in order to get the homepage to display when no mod value is passed... /* Change the query if no mod was passed to retrieve the Page where mod = null */ if ($colname_rs_pagetoshow <= '-1') { $query_rs_pagetoshow = sprintf("SELECT * FROM pages WHERE pag_modvalue IS NULL"); } else { $query_rs_pagetoshow = sprintf("SELECT * FROM pages WHERE pag_modvalue = '%s'", $colname_rs_pagetoshow); }
And the only menu properties that work when used with MXIncludes are "Retrieved from Database" with the URL coded as "index.php?mod=pagetocall" which still needs a separate field for modvalue, requiring "pagetocall" to be entered in two places.
It would be better if the Dynamic Menus properties allowed for... URL: Select Field from Database (containing "index.php" for example) URL Parameter: Select field from database (Containing the mod value "aboutus" for example)
...and then the templates generated the link... index.php?mod=aboutus
If I use the settings... URL: "index.php?mod=" URL Parameter: FieldWithParameter I can't get the homepage to display when "index.php?mod=" is called or "index.php" is called with no mod value - I can't remember which?
|
|
|
Ionut MOICIANU
05-03-2006 17:30:37 GMT +2
|
Hello Geoff,
You need to use these settings:
URL: "index.php?mod="
URL Parameter: FieldWithParameter
The URL Parameter field will have a certain value for the home page (why are you having null instead?), like "home" or "0" (if the URL Param. field is of Numeric type). And you will set up the "SSI From List" SB to open the home page for this value of the "mod" parameter.
Your suggestion with having the option for both base URL and URL parameter to be bound to database fields has been discussed several times on the forum (see thread1, thread2, thread3 etc.) but I don't htink you need this kind of work-around if all your links will refer as "index.php?mod=.." , so the base URL will always be the same.
Ionut
|
|
|
purple edge
05-04-2006 03:14:11 GMT +2
|
To answer the first part of your question - because it doesn't work! What happens if the user types "www.mywebsite.com" instead of "www.mywebsite.com?index=0 or home" ? It comes up with a blank page, not the home page. I am using CSS Dynamic menus with MX Includes - the behavior is different if used standalone.If you look at the help for MX Includes, it says the home page Mod
value must be blank, that is why I am using that value <g> (Maybe I am doing this wrong?)
QUOTE - In the URL value text box enter
the value for the URL parameter passed.
If you choose to enter no value in the URL value
text box, then the associated file will be the one loaded by default in
browser.
Note: If you enter the value 404 for the URL parameter value, then
the associated file will be automatically loaded when a page cannot be found
(e.g. due to a missing page, or a wrong URL parameter value).
UNQUOTE The response to the second part of your answer is - that is fine, so
long as every page points to index.php, but it means every page MUST
point to index.php - hardly dynamic!
|
|
|
purple edge
05-07-2006 05:11:37 GMT +2
|
I think it would be better if you changed, or added, the capability for CSS Menus to truly use dynamic links from the database. Of course I can code around the limitations of CSS Dynamic menus, but there are obviously a lot of users who would prefer it to be more logically designed? It would help also to make it more compatible with MX Includes, since the two products could work extremely well together with some simple modifications?
|
|
|
Ionut MOICIANU
05-10-2006 12:30:34 GMT +2
|
Hello,
You are right, you should not set a certain value for the "mod" parameter if your home page is "index.php".
From what I know, it should work if the value of "mod" parameter is null. It should load the "index.php" page. If you want me to dbug this problem on your site, I would need URL and FTP access.
You could also try to set the type of the "URL Parameter" db field to varchar and set the value to '' or ' ' for the home page instead of null.
Your suggestion is already noted down, as several people asked for this feature. But for now, you could only try the work-around given in the threads I pointed to above (in fact, they point to a "dynamic" solution, I was just presuming you are using a fix base URL).
Ionut
|
|
|
richard koeleman
05-20-2006 18:41:08 GMT +2
|
Don't make it so hard on yourselves, the dynamics can be made from the SQL statement,
For example, what I always do when I want some menu items to link to a database generated ID, and some other links in the menu should point to different sites or site sections:
You tell the SQL statement to use a database field that has the url in it, however if that field is empty it should construct a link.
SELECT ID, ParentID, TitleEN, IntroEN,ImagePassive, ImageActive, Target, Prio, Active, `Date`, IF(db_menu.Href=0,db_menu.Href,CONCAT('http://www.somesite.com/index.php?MID', '=',db_menu.ID)) AS Href FROM db_menu WHERE Active = 1 ORDER BY Prio ASC, Title
Hope that helps.
Kind regards, Richard
|
|
|
purple edge
05-23-2006 15:51:07 GMT +2
|
Thanks Richard for the suggestion, however looking at it today I don't think I can do this. The problem is that the ?mod= can have two values for the home page... mod IS NULL mod='homepage' Plus, mod can have lots of other values for other pages. So the problem is, what to select when 'mod is null' - as is required by the css dynamic menus and the mx includes templates. I think I might be able to use two recordsets and conditionally display one of them when 'mod is null' Seems more ugly than my few lines of hacking? Can I do a conditional WHERE statement in mysql?
|
|
|
richard koeleman
05-23-2006 20:21:30 GMT +2
|
The two recordsets with an if statement would probably be a good solution.
You could also think about the mx includes, for example when you use an mx include after a recordset or another function, the mx include will work like a regular include so it will accept any parameters you defined before the include.
So let's say you would create a page where it has a special behaviour if the ?mod= is empty, you could do either
1. Make a master file that will include a different file depending on the mod variable
2. Include a file that will tell you what other file to include, in my case that would be the body page is always included in my index file, and the body page has the logic of including several different files. It takes any parameters from the index file (or url), it looks up the files that need to be included and runs through them
Just an example: (some sql query that is called get_content) <?php while (!$get_content->EOF) { ?> <?php $include_item = $get_content->Fields('ModFile'); // Get the file to include $PID = $get_content->Fields('ModContID'); // Get the database content for that specific file ?> <?php mxi_includes_start($include_item); require(basename($include_item)); mxi_includes_end(); ?>
Get the content needed for a specific parameter, this can be text, lists etc and have it included in the body file. Any other parameters can be called upon here as well ofcourse since the include will use them no problem.
On your question if you can do the WHERE statement, the answer depends a little on the mysql version, the item you are looking for is CASE
An example: SELECT ID, ParentID, Title, Intro,ImagePassive, ImageActive, Target, Prio, Active, `Date`, (CASE WHEN ISNULL(db_menu.Href) THEN CONCAT('http://www.someurl.com/index.php?MID', '=',db_menu.ID) WHEN db_menu.Href = '#' THEN '$parameter_request' ELSE db_menu.Href END ) AS Link FROM db_menu WHERE Active = 1 ORDER BY Prio ASC, Title
It is very similar to the if statement. The other thing to remember is you are able to create select statements whithin select statements. That might save you as well.
I hope that helps you into the right direction a little. If you need some more input, please tell in detail what you are looking to achieve.
Kind regards, Richard
|
|
|
|
|