Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Creating a Custom PageID

  1. #11
    Join Date
    Jul 2005
    Location
    Sao Paulo, BRAZIL
    Posts
    3,763

    Default Re: Creating a Custom PageID

    Quote Originally Posted by appalachian View Post
    I ended up writing it into OR. Maybe someone can move this thread to a forum for suggestions for the next release. If this was done, it could be added to the docs in the same place as discussion about customizing the main templates for searchresults_main.html and page#_main.html.
    To follow the general format in OR, I created my custom main template and named it listingview_main.html. Then I added the following lines shown in red in index.php:
    MODERATED - Core file changes can only be discussed in the sandbox forum. If you want to submit a feature requests, use the feature request link form the forum.
    Hopefully nothing was changed during the post to the message board. It is simply copying and pasting the two lines for "searchresults" and substituting "listingview" instead.
    John
    John,

    You did unnecessary and HIGHLY not recommended changes.
    Rename your "listingview_main.html" template file to "pagelistingview_main.html"

    IF... you are going to only use SEF links, there is no need to edit any template file - keep them as default. Only modify your ".htaccess" file:
    FROM:
    Code:
    RewriteRule ^listing-(.*)-([0-9]*).html index.php?action=listingview&listingID=$2 [L]
    TO:
    Code:
    RewriteRule ^listing-(.*)-([0-9]*).html index.php?action=listingview&listingID=$2&PageID=listingview [L]
    IF... you are NOT going to use SEF links, at all your HTML template files (that have links to listing detail page), you will need to edit the links. For example:
    FROM: {link_to_listing} TO {link_to_listing}&PageID=listingview
    FROM: {featured_url} TO {featured_url}&PageID=listingview

    That's all, there is no magic.
    Eduardo

    Open-Realty® DOCs
    We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light. (Author Unknown)

  2. #12
    Join Date
    Feb 2010
    Posts
    19

    Default Re: Creating a Custom PageID

    Quote Originally Posted by appalachian View Post

    MODERATED - Core file changes can only be discussed in the sandbox forum. If you want to submit a feature requests, use the feature request link form the forum.
    I posted this topic in the sandbox forum because I knew it was not a template customizing issue, but the thread was moved here by someone else.

  3. #13
    Join Date
    Jul 2005
    Location
    Sao Paulo, BRAZIL
    Posts
    3,763

    Default Re: Creating a Custom PageID

    Quote Originally Posted by appalachian View Post
    ...because I knew it was not a template customizing issue...
    It is a template issue only.

    Open-Realty® DOCs
    We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light. (Author Unknown)

  4. #14
    Join Date
    Feb 2010
    Posts
    19

    Default Re: Creating a Custom PageID

    Quote Originally Posted by ebmarques View Post
    John,

    IF... you are NOT going to use SEF links, at all your HTML template files (that have links to listing detail page), you will need to edit the links. For example:
    FROM: {link_to_listing} TO {link_to_listing}&PageID=listingview
    FROM: {featured_url} TO {featured_url}&PageID=listingview
    I appreciate your help. The html files (ie. search_result_default.html) use tags that pull the links from elsewhere. Are you saying I should remove the tag and use a **a href=** link instead, if I don't use SEF? What identifies which listing number to point to? If there is only 1 listing today and a 2nd added tomorrow, when and where does the link to listing 2 get added?

    I'm probably not understanding you correctly. Maybe copy a line here from search_result_default.html and then show me what to change it to.

    Thanks

  5. #15
    Join Date
    Jul 2005
    Location
    Sao Paulo, BRAZIL
    Posts
    3,763

    Default Re: Creating a Custom PageID

    Quote Originally Posted by appalachian View Post
    ...I'm probably not understanding you correctly. Maybe copy a line here from search_result_default.html and then show me what to change it to.
    John, try what I have posted. You only have to modify htaccess file and create a new template file. Nothing more, using SEF URL's.

    Open-Realty® DOCs
    We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light. (Author Unknown)

  6. #16
    Join Date
    Feb 2010
    Posts
    19

    Default Re: Creating a Custom PageID

    I changed everything back as you suggested, however, if for some reason in the future I wish to stop using SEF, this configuration will not work. Wouldn't it make more sense to request the coding change for a future release so it would work regardless if SEF was used or not? being able to simply change the custom main.html to another name, like can be done with searchresults_main.html, without doing anything else would be much easier.

    The documents are misleading by saying ".....The PageID=# variable is specified automatically for all page editor created pages, you can create a custom PageID for any other page you wish to have an alternate main template layout for." This is true, but that's not all you have to do to make it work. The part about either changing the .htaccess or the link in other html pages is not written there. There are others who have come here for the same issue.

    If I wanted to move away from SEF, which part of search_result_default.html would have to be changed to point ALL listings to the new pagelistingview_main.html? I don't see any links in the file, as they are passed through from elsewhere. (possibly from search_result_dataset?)


    Thread moved to Sandbox forum at the request of the OP

  7. #17
    Join Date
    Jul 2005
    Location
    Sao Paulo, BRAZIL
    Posts
    3,763

    Default Re: Creating a Custom PageID

    Quote Originally Posted by appalachian View Post
    I changed everything back as you suggested, however, if for some reason in the future I wish to stop using SEF, this configuration will not work.
    That's right it will not work, so you will need to do more... You will need to edit the links, as I already said. As alternative, you can add a NEW line at htaccess file (with a new rewrite rule). Still templating, no core files changes are needed.

    Quote Originally Posted by appalachian View Post
    Wouldn't it make more sense to request the coding change for a future release so it would work regardless if SEF was used or not? being able to simply change the custom main.html to another name, like can be done with searchresults_main.html, without doing anything else would be much easier.
    If yes or not... the place for this discussion is:
    http://www.open-realty.org/featurerequest/
    IMO... yes, we could add a special main template for the listing detail page.


    Quote Originally Posted by appalachian View Post
    The documents are misleading by saying ".....The PageID=# variable is specified automatically for all page editor created pages, you can create a custom PageID for any other page you wish to have an alternate main template layout for." This is true, but that's not all you have to do to make it work. The part about either changing the .htaccess or the link in other html pages is not written there. There are others who have come here for the same issue.
    Again, here is the place to discuss it:
    http://www.open-realty.org/featurerequest/


    Quote Originally Posted by appalachian View Post
    If I wanted to move away from SEF, which part of search_result_default.html would have to be changed to point ALL listings to the new pagelistingview_main.html? I don't see any links in the file, as they are passed through from elsewhere. (possibly from search_result_dataset?)
    I have already posted at #2. Assuming the default site template Lazuli, if you look the source code of "search_result_default.html" you will see these lines:
    HTML Code:
    <p><a href="{link_to_listing}" title="{listing_title}">{listing_title}</a></p>
    <p><a href="{link_to_listing}" title="{listing_title}"><img src="{raw_image_thumb_1}" alt="" /></a></p>
    Modify to:
    HTML Code:
    <p><a href="{link_to_listing}&PageID=listingview" title="{listing_title}">{listing_title}</a></p>
    <p><a href="{link_to_listing}&PageID=listingview" title="{listing_title}"><img src="{raw_image_thumb_1}" alt="" /></a></p>
    But you also have links to be edited at "featured", "latest", "random" templates - where you will find links like this one:
    HTML Code:
    <a href="{featured_url}" title="" class="thumb">...
    Modify to:
    HTML Code:
    <a href="{featured_url}&PageID=listingview" title="" class="thumb">...
    NOTICE: there is an alternative - all those changes at template files can be replaced adding a NEW line at your htaccess file, with a NEW rewrite rule.
    I am not an expert on rewrite rules so lets wait for someone that can show it for us.

    Eduardo

    Open-Realty® DOCs
    We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light. (Author Unknown)

  8. #18
    Join Date
    Feb 2010
    Posts
    19

    Default Re: Creating a Custom PageID

    Ah....I see where the confusion about adding links to search_result_default.html and the other html templates is coming from. I used City Lights as my beginning template set and the pages in that package do not use links like appear in Lazuli. It uses tags to pull from elsewhere. So, my options are changing .htaccess or configuring Php to handle "listingview" using the same method used for "searchresults" so that no further steps are needed.

    I understand that changing core files is not wise, especially because hacks would be lost during new releases. However, they are rare and I keep a record of my work so that I can apply the same mods later if needed again. My intent here was to show how a couple of lines of Php would allow ANY html file to have a custom _main.html by simply renaming it like OR has already done with searchresults_main.html. If others agree, it could be requested for a future release. IMHO, I would rather someone change a little Php, because an incorrectly configured .htaccess could open up security threats much easier.

    Here is the code change needed in index.php to allow someone to simply rename a customized main.html to listingview_main.html. upload it into the template directory, and begin using it. This would also allow OR documents to be corrected by adding the file name needed to have a customized main page to use with Listing Detail. I'm new to the message board, so I think I am supposed to post code here and then go to Feature Request to request it??

    I'm just trying help so others will not have to come here searching for a solution like I did. I appreciate the help from others on this board very much.

    John

    if (isset($_GET['PageID']) && file_exists($config['template_path'] . '/page' . $_GET['PageID'] . '_main.html')) {
    $page->load_page($config['template_path'] . '/page' . $_GET['PageID'] . '_main.html');
    } elseif ($_GET['action'] == 'index' && file_exists($config['template_path'] . '/page1_main.html')) {
    $page->load_page($config['template_path'] . '/page1_main.html');
    } elseif ($_GET['action'] == 'searchresults' && file_exists($config['template_path'] . '/searchresults_main.html')) {
    $page->load_page($config['template_path'] . '/searchresults_main.html');
    } elseif ($_GET['action'] == 'listingview' && file_exists($config['template_path'] . '/listingview_main.html')) {
    $page->load_page($config['template_path'] . '/listingview_main.html');

    } else {
    $page->load_page($config['template_path'] . '/main.html');
    }

Similar Threads

  1. Creating custom Tags
    By timboellis in forum Templates - Help/Ideas/Discussion (CLOSED)
    Replies: 4
    Last Post: 08-22-2009, 07:17 AM
  2. Creating custom permission tags
    By Nuwanda in forum Addon help, ideas and discussion (CLOSED)
    Replies: 0
    Last Post: 08-20-2009, 12:54 AM
  3. Creating a Custom Template Tutorial
    By manamedia in forum Templates - Help/Ideas/Discussion (CLOSED)
    Replies: 20
    Last Post: 06-26-2008, 06:58 AM
  4. Creating a custom contact form
    By bikeman in forum General Help (CLOSED)
    Replies: 2
    Last Post: 12-26-2007, 02:25 PM
  5. Creating custom template - help with images
    By beley in forum Templates - Help/Ideas/Discussion (CLOSED)
    Replies: 3
    Last Post: 12-29-2005, 01:33 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •